Package com.jme3.anim

Class Joint

java.lang.Object
com.jme3.anim.Joint
All Implemented Interfaces:
HasLocalTransform, Savable, JmeCloneable, Cloneable

public class Joint extends Object implements Savable, JmeCloneable, HasLocalTransform
A Joint is the basic component of an armature designed to perform skeletal animation Created by Nehon on 15/12/2017.
  • Constructor Details

    • Joint

      public Joint()
      Instantiate a nameless Joint.
    • Joint

      public Joint(String name)
      Instantiate a Joint with the specified name.
      Parameters:
      name - the desired name
  • Method Details

    • update

      public final void update()
      Updates world transforms for this bone and its children.
    • updateModelTransforms

      public final void updateModelTransforms()
      Updates the model transforms for this bone and for the attachments node if not null.

      The model transform of this bone is computed by combining the parent's model transform with this bone's local transform.

    • getOffsetTransform

      protected void getOffsetTransform(Matrix4f outTransform)
      Stores the skinning transform in the specified Matrix4f. The skinning transform applies the animation of the bone to a vertex.

      This assumes that the world transforms for the entire bone hierarchy have already been computed, otherwise this method will return undefined results.

      Parameters:
      outTransform - storage for the result (modified)
    • saveBindPose

      protected void saveBindPose()
      Sets the current localTransform as the Bind transform.
    • saveInitialPose

      protected void saveInitialPose()
      Sets the current local transforms as the initial transform.
    • applyBindPose

      public void applyBindPose()
      Sets the local transform with the bind transforms
    • applyInitialPose

      protected void applyInitialPose()
      Sets the local transform with the initial transform
    • getJointModelTransform

      protected JointModelTransform getJointModelTransform()
      Access the accumulated model transform.
      Returns:
      the pre-existing instance
    • setJointModelTransform

      protected void setJointModelTransform(JointModelTransform jointModelTransform)
      Replace the accumulated model transform.
      Parameters:
      jointModelTransform - the transform to use (alias created)
    • getLocalTranslation

      public Vector3f getLocalTranslation()
      Access the local translation vector.
      Returns:
      the pre-existing vector
    • getLocalRotation

      public Quaternion getLocalRotation()
      Access the local rotation.
      Returns:
      the pre-existing Quaternion
    • getLocalScale

      public Vector3f getLocalScale()
      Access the local scale vector.
      Returns:
      the pre-existing vector
    • setLocalTranslation

      public void setLocalTranslation(Vector3f translation)
      Alter the local translation vector.
      Parameters:
      translation - the desired offset vector (not null, unaffected)
    • setLocalRotation

      public void setLocalRotation(Quaternion rotation)
      Alter the local rotation.
      Parameters:
      rotation - the desired rotation (not null, unaffected)
    • setLocalScale

      public void setLocalScale(Vector3f scale)
      Alter the local scale vector.
      Parameters:
      scale - the desired scale factors (not null, unaffected)
    • addChild

      public void addChild(Joint child)
      Add the specified Joint as a child.
      Parameters:
      child - the Joint to add (not null, modified)
    • setName

      public void setName(String name)
      Alter the name.
      Parameters:
      name - the desired name
    • setLocalTransform

      public void setLocalTransform(Transform localTransform)
      Alter the local transform.
      Specified by:
      setLocalTransform in interface HasLocalTransform
      Parameters:
      localTransform - the desired Transform (not null, unaffected)
    • setInverseModelBindMatrix

      public void setInverseModelBindMatrix(Matrix4f inverseModelBindMatrix)
      Replace the inverse model bind matrix.
      Parameters:
      inverseModelBindMatrix - the matrix to use (alias created)
    • getName

      public String getName()
      Determine the name.
      Returns:
      the name
    • getParent

      public Joint getParent()
      Access the parent joint.
      Returns:
      the pre-existing instance, or null if this is a root joint
    • getChildren

      public List<Joint> getChildren()
      Access the list of child joints.
      Returns:
      the pre-existing list
    • getAttachmentsNode

      protected Node getAttachmentsNode(int jointIndex, SafeArrayList<Geometry> targets)
      Access the attachments node of this joint. If this joint doesn't already have an attachments node, create one. Models and effects attached to the attachments node will follow this bone's motions.
      Parameters:
      jointIndex - this bone's index in its armature (≥0)
      targets - a list of geometries animated by this bone's skeleton (not null, unaffected)
      Returns:
      the attachments node (not null)
    • getInitialTransform

      public Transform getInitialTransform()
      Access the initial transform.
      Returns:
      the pre-existing instance
    • getLocalTransform

      public Transform getLocalTransform()
      Access the local transform.
      Specified by:
      getLocalTransform in interface HasLocalTransform
      Returns:
      the pre-existing instance
    • getModelTransform

      public Transform getModelTransform()
      Determine the model transform.
      Returns:
      a shared instance
    • getInverseModelBindMatrix

      public Matrix4f getInverseModelBindMatrix()
      Determine the inverse model bind matrix.
      Returns:
      the pre-existing instance
    • getId

      public int getId()
      Determine this joint's index in the Armature that contains it.
      Returns:
      an index (≥0)
    • setId

      public void setId(int id)
      Alter this joint's index in the Armature that contains it.
      Parameters:
      id - the desired index (≥0)
    • jmeClone

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

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

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

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