Package com.github.stephengold.joltjni
Class RagdollSettingsRef
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.template.Ref
com.github.stephengold.joltjni.RagdollSettingsRef
- All Implemented Interfaces:
ConstJoltPhysicsObject,ConstRagdollSettings,AutoCloseable,Comparable<JoltPhysicsObject>
A counted reference to a
RagdollSettings object. (native type:
Ref<RagdollSettings>)-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalConstraint(AdditionalConstraint constraint) Add the specified constraint.voidPre-calculate the map used bygetBodyIndexToConstraintIndex().voidPre-calculate the map used bygetConstraintIndexToBodyIdxPair().voidInitialize the constraint priorities so that constraints near the leaves have priority than those near the root.voidcalculateConstraintPriorities(int basePriority) Initialize the constraint priorities so that constraints near the leaves have priority than those near the root.createRagdoll(int groupId, long userData, PhysicsSystem physicsSystem) Generate a ragdoll instance from the settings, which are unaffected.voidCreate and add collision filters to all bodies in the ragdoll and configure them so parents and children don't collide.getBodyIndicesForConstraintIndex(int constraintIndex) Access the body-index pair for the specified constraint.intgetConstraintIndexForBodyIndex(int bodyIndex) Return the index of the constraint upstream from the specified body.intCount the parts.getPart(int partIndex) Access the part for the specified index.Part[]getParts()Access the parts by way of a Java array.getPtr()Access the targeted settings, if any.Access the skeleton.voidresizeParts(int numParts) Resize the parts array.voidsaveBinaryState(StreamOut stream, boolean saveShapes, boolean saveGroupFilter) Save the settings to the specified binary stream.voidsetSkeleton(Skeleton skeleton) Replace the skeleton.static RagdollResultsRestoreFromBinaryState(StreamIn stream) Read a ragdoll from the specified input stream.booleanStabilize the constraints.longReturn the address of the nativeRagdollSettings.toRef()Create an additional counted reference to the targeted settings.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, 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
-
RagdollSettingsRef
public RagdollSettingsRef()Instantiate an empty reference.
-
-
Method Details
-
addAdditionalConstraint
Add the specified constraint.- Parameters:
constraint- (notnull)
-
calculateBodyIndexToConstraintIndex
public void calculateBodyIndexToConstraintIndex()Pre-calculate the map used bygetBodyIndexToConstraintIndex(). -
calculateConstraintIndexToBodyIdxPair
public void calculateConstraintIndexToBodyIdxPair()Pre-calculate the map used bygetConstraintIndexToBodyIdxPair(). -
calculateConstraintPriorities
public void calculateConstraintPriorities()Initialize the constraint priorities so that constraints near the leaves have priority than those near the root. -
calculateConstraintPriorities
public void calculateConstraintPriorities(int basePriority) Initialize the constraint priorities so that constraints near the leaves have priority than those near the root.- Parameters:
basePriority- the lowest priority to use (default=0)
-
disableParentChildCollisions
public void disableParentChildCollisions()Create and add collision filters to all bodies in the ragdoll and configure them so parents and children don't collide. -
getParts
Access the parts by way of a Java array. (native attribute: mParts)- Returns:
- a new array of new JVM objects with pre-existing native objects assigned
-
resizeParts
public void resizeParts(int numParts) Resize the parts array.- Parameters:
numParts- the desired number of parts (≥0)
-
setSkeleton
Replace the skeleton. (native attribute: mSkeleton)- Parameters:
skeleton- the desired skeleton (notnull)
-
sRestoreFromBinaryState
Read a ragdoll from the specified input stream.- Parameters:
stream- the stream to read from (notnull)- Returns:
- the result of the read (not
null)
-
stabilize
public boolean stabilize()Stabilize the constraints.- Returns:
trueif successful, otherwisefalse
-
createRagdoll
Generate a ragdoll instance from the settings, which are unaffected.- Specified by:
createRagdollin interfaceConstRagdollSettings- Parameters:
groupId- the collision group for the bodiesuserData- the desired user-data valuephysicsSystem- where to add the bodies and constraints (notnull, modified)- Returns:
- a new ragdoll instance, or
nullwhen out of bodies
-
getBodyIndicesForConstraintIndex
Access the body-index pair for the specified constraint.- Specified by:
getBodyIndicesForConstraintIndexin interfaceConstRagdollSettings- Parameters:
constraintIndex- the index of the constraint (≥0)- Returns:
- a new JVM object with the pre-existing native object assigned
-
getConstraintIndexForBodyIndex
public int getConstraintIndexForBodyIndex(int bodyIndex) Return the index of the constraint upstream from the specified body. The settings are unaffected.- Specified by:
getConstraintIndexForBodyIndexin interfaceConstRagdollSettings- Parameters:
bodyIndex- index of the body in the ragdoll (≥0)- Returns:
- the constraint index
-
getNumParts
public int getNumParts()Count the parts. The settings are unaffected.- Specified by:
getNumPartsin interfaceConstRagdollSettings- Returns:
- the count (≥0)
-
getPart
Access the part for the specified index.- Specified by:
getPartin interfaceConstRagdollSettings- Parameters:
partIndex- index of the part (≥0)- Returns:
- a new JVM object with pre-existing native object assigned
-
getSkeleton
Access the skeleton. (native attribute: mSkeleton)- Specified by:
getSkeletonin interfaceConstRagdollSettings- Returns:
- a new JVM object with the pre-existing native object assigned
-
saveBinaryState
Save the settings to the specified binary stream. The settings are unaffected.- Specified by:
saveBinaryStatein interfaceConstRagdollSettings- Parameters:
stream- the stream to write to (notnull)saveShapes- if true, save the shapessaveGroupFilter- if true, save the group filter
-
getPtr
Access the targeted settings, if any. -
targetVaOrZero
public long targetVaOrZero()Return the address of the nativeRagdollSettings. No objects are affected.- Specified by:
targetVaOrZeroin interfaceConstJoltPhysicsObject- Overrides:
targetVaOrZeroin classJoltPhysicsObject- Returns:
- the virtual address, or zero if the reference is empty
-
toRef
Create an additional counted reference to the targeted settings.
-