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 TypeMethodDescriptionint
Add a root joint.int
Add a non-root joint.boolean
Test whether the joints are correctly ordered, parents before children.void
Fill in the parent joint indices based on name.getJoint
(int jointIndex) Access the specified joint.int
Count how many joints are in the skeleton.int
getJointIndex
(String name) Find the index of the named joint.Joint[]
Access all the joints.int
Count the active references to the nativeSkeleton
.void
saveBinaryState
(StreamOut stream) Save the skeleton to the specified binary stream.void
Mark the nativeSkeleton
as embedded.toRef()
Create a counted reference to the nativeSkeleton
.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods 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:
areJointsCorrectlyOrdered
in interfaceConstSkeleton
- Returns:
true
if in order, otherwisefalse
-
getJoint
Access the specified joint.- Specified by:
getJoint
in 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:
getJointCount
in interfaceConstSkeleton
- Returns:
- the count (≥0)
-
getJointIndex
Find the index of the named joint.- Specified by:
getJointIndex
in interfaceConstSkeleton
- Parameters:
name
- the name of the joint to find (not null)- Returns:
- the joint index
-
getJoints
Access all the joints.- Specified by:
getJoints
in 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:
saveBinaryState
in 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:
getRefCount
in interfaceRefTarget
- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeSkeleton
as embedded.- Specified by:
setEmbedded
in interfaceRefTarget
-
toRef
Create a counted reference to the nativeSkeleton
.
-