java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.Skeleton
- All Implemented Interfaces:
ConstJoltPhysicsObject,ConstSkeleton,RefTarget,AutoCloseable,Comparable<JoltPhysicsObject>
A joint hierarchy for skeletal animation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintAdd a root joint.intAdd a non-root joint.booleanTest whether the joints are correctly ordered, parents before children.voidFill in the parent joint indices based on name.getJoint(int jointIndex) Access the specified joint.intCount how many joints are in the skeleton.intgetJointIndex(String name) Find the index of the named joint.Joint[]Access all the joints.intCount the active references to the nativeSkeleton.voidsaveBinaryState(StreamOut stream) Save the skeleton to the specified binary stream.voidMark the nativeSkeletonas embedded.toRef()Create a counted reference to the nativeSkeleton.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
Skeleton
public Skeleton()Instantiate a default skeleton.
-
-
Method Details
-
addJoint
Add a root joint.- Parameters:
name- the desired joint name- Returns:
- the index of the new joint
-
addJoint
Add a non-root joint.- Parameters:
name- the desired joint nameparentIndex- 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:
areJointsCorrectlyOrderedin interfaceConstSkeleton- Returns:
trueif in order, otherwisefalse
-
getJoint
Access the specified joint.- Specified by:
getJointin interfaceConstSkeleton- 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:
getJointCountin interfaceConstSkeleton- Returns:
- the count (≥0)
-
getJointIndex
Find the index of the named joint.- Specified by:
getJointIndexin interfaceConstSkeleton- Parameters:
name- the name of the joint to find (not null)- Returns:
- the joint index
-
getJoints
Access all the joints.- Specified by:
getJointsin interfaceConstSkeleton- Returns:
- a new array of new JVM objects with the pre-existing native objects assigned
-
saveBinaryState
Save the skeleton to the specified binary stream.- Specified by:
saveBinaryStatein interfaceConstSkeleton- Parameters:
stream- the stream to write to (not null)
-
getRefCount
public int getRefCount()Count the active references to the nativeSkeleton. The skeleton is unaffected.- Specified by:
getRefCountin interfaceRefTarget- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeSkeletonas embedded.- Specified by:
setEmbeddedin interfaceRefTarget
-
toRef
Create a counted reference to the nativeSkeleton.
-