Class PhysicsLink

All Implemented Interfaces:
Savable, JmeCloneable, Cloneable
Direct Known Subclasses:
BoneLink, TorsoLink

public abstract class PhysicsLink extends Object implements JmeCloneable, Savable
The abstract base class used by DynamicAnimControl to link pieces of a JME model to their corresponding collision objects in a ragdoll. Subclasses include BoneLink and TorsoLink. The links in each DynamicAnimControl form a hierarchy with the TorsoLink at its root.

This class is shared between JBullet and Native Bullet.

  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Constructor Details

    • PhysicsLink

      protected PhysicsLink()
      No-argument constructor needed by SavableClassUtil. Do not invoke directly!
  • Method Details

    • boneName

      public String boneName()
      Read the name of the corresponding bone.
      the bone name (not null)
    • countChildren

      public int countChildren()
      Count this link's immediate children in the link hierarchy.
      the count (≥0)
    • getBone

      public final Joint getBone()
      Access the corresponding bone.
      the pre-existing instance (not null)
    • getControl

      public DacLinks getControl()
      Access the control that manages this link.
      the pre-existing instance (not null)
    • getJoint

      public PhysicsJoint getJoint()
      Access the joint between this link's rigid body and that of its parent.
      the pre-existing instance, or null for the torso
    • getParent

      public PhysicsLink getParent()
      Access this link's parent/manager in the link hierarchy.
      the link, or null if none
    • getRigidBody

      public PhysicsRigidBody getRigidBody()
      Access the linked rigid body.
      the pre-existing instance (not null)
    • isKinematic

      public boolean isKinematic()
      Test whether the link is in kinematic mode.
      true if kinematic, or false if purely dynamic
    • kinematicWeight

      public float kinematicWeight()
      Read the kinematic weight of this link.
      0 if purely dynamic, 1 if purely kinematic
    • listChildren

      public PhysicsLink[] listChildren()
      Enumerate this link's immediate children in the link hierarchy.
      a new array (not null)
    • name

      public abstract String name()
      Unambiguously identify this link by name, within its DynamicAnimControl.
      a text string (not null, not empty)
    • physicsTransform

      public Transform physicsTransform(Transform storeResult)
      Calculate a physics transform for the rigid body (to match the skeleton bone).
      storeResult - storage for the result (modified if not null)
      the calculated transform (in physics-space coordinates, either storeResult or a new transform, not null)
    • setDynamic

      public void setDynamic(Vector3f uniformAcceleration)
      Immediately put this link into dynamic mode. The control must be "ready".
      uniformAcceleration - the uniform acceleration vector to apply (in physics-space coordinates, not null, unaffected)
    • blendToKinematicMode

      protected void blendToKinematicMode(float blendInterval)
      Begin blending this link to a purely kinematic mode.
      blendInterval - the duration of the blend interval (in seconds, ≥0)
    • dynamicUpdate

      protected abstract void dynamicUpdate()
      Update this link in Dynamic mode, setting the linked bone's transform based on the transform of the rigid body.
    • kinematicUpdate

      protected void kinematicUpdate(float tpf)
      Update this link in blended Kinematic mode.
      tpf - the time interval between frames (in seconds, ≥0)
    • localOffset

      protected Vector3f localOffset(Vector3f storeResult)
      Copy the local offset of this link.
      storeResult - storage for the result (modified if not null)
      the offset (in bone local coordinates, either storeResult or a new vector, not null)
    • setJoint

      protected final void setJoint(PhysicsJoint joint)
      Assign a physics joint to this link, or cancel the assigned joint.
      joint - (may be null, alias created)
    • setParent

      protected final void setParent(PhysicsLink parent)
      Assign a parent/manager for this link.
      parent - (not null, alias created)
    • setRigidBody

      protected void setRigidBody(PhysicsRigidBody body)
      Alter the rigid body for this link.
      body - the desired rigid body (not null, alias created)
    • cloneFields

      public void cloneFields(Cloner cloner, Object original)
      Callback from Cloner to convert this shallow-cloned link into a deep-cloned one, using the specified cloner and original to resolve copied fields.
      Specified by:
      cloneFields in interface JmeCloneable
      cloner - the cloner that's cloning this link (not null)
      original - the instance from which this link was shallow-cloned (unused)
    • jmeClone

      public PhysicsLink jmeClone()
      Create a shallow clone for the JME cloner.
      Specified by:
      jmeClone in interface JmeCloneable
      a new instance
    • read

      public void read(JmeImporter im) throws IOException
      De-serialize this link, for example when loading from a J3O file.
      Specified by:
      read in interface Savable
      im - importer (not null)
      IOException - from importer
    • write

      public void write(JmeExporter ex) throws IOException
      Serialize this link, for example when saving to a J3O file.
      Specified by:
      write in interface Savable
      ex - exporter (not null)
      IOException - from exporter