All Implemented Interfaces:
ConstJoltPhysicsObject, ConstSkeleton, RefTarget, AutoCloseable, Comparable<JoltPhysicsObject>

public class Skeleton extends JoltPhysicsObject implements ConstSkeleton, RefTarget
A joint hierarchy for skeletal animation.
  • Constructor Details

    • Skeleton

      public Skeleton()
      Instantiate a default skeleton.
  • Method Details

    • addJoint

      public int addJoint(String name)
      Add a root joint.
      Parameters:
      name - the desired joint name
      Returns:
      the index of the new joint
    • addJoint

      public int addJoint(String name, int parentIndex)
      Add a non-root joint.
      Parameters:
      name - the desired joint name
      parentIndex - the index of the desired parent joint
      Returns:
      the index of the new joint
    • calculateParentJointIndices

      public void calculateParentJointIndices()
      Fill in the parent joint indices based on name.
    • areJointsCorrectlyOrdered

      public boolean areJointsCorrectlyOrdered()
      Test whether the joints are correctly ordered, parents before children.
      Specified by:
      areJointsCorrectlyOrdered in interface ConstSkeleton
      Returns:
      true if in order, otherwise false
    • getJoint

      public Joint getJoint(int jointIndex)
      Access the specified joint.
      Specified by:
      getJoint in interface ConstSkeleton
      Parameters:
      jointIndex - the index of the joint to access (≥0)
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getJointCount

      public int getJointCount()
      Count how many joints are in the skeleton.
      Specified by:
      getJointCount in interface ConstSkeleton
      Returns:
      the count (≥0)
    • getJointIndex

      public int getJointIndex(String name)
      Find the index of the named joint.
      Specified by:
      getJointIndex in interface ConstSkeleton
      Parameters:
      name - the name of the joint to find (not null)
      Returns:
      the joint index
    • getJoints

      public Joint[] getJoints()
      Access all the joints.
      Specified by:
      getJoints in interface ConstSkeleton
      Returns:
      a new array of new JVM objects with the pre-existing native objects assigned
    • saveBinaryState

      public void saveBinaryState(StreamOut stream)
      Save the skeleton to the specified binary stream.
      Specified by:
      saveBinaryState in interface ConstSkeleton
      Parameters:
      stream - the stream to write to (not null)
    • getRefCount

      public int getRefCount()
      Count the active references to the native Skeleton. The skeleton is unaffected.
      Specified by:
      getRefCount in interface RefTarget
      Returns:
      the count (≥0)
    • setEmbedded

      public void setEmbedded()
      Mark the native Skeleton as embedded.
      Specified by:
      setEmbedded in interface RefTarget
    • toRef

      public SkeletonRef toRef()
      Create a counted reference to the native Skeleton.
      Specified by:
      toRef in interface RefTarget
      Returns:
      a new JVM object with a new native object assigned