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,AutoCloseable,Comparable<JoltPhysicsObject>
A counted reference to a
RagdollSettings object. (native type:
Ref<RagdollSettings>)-
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().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.Part[]getParts()Access the parts by way of a Java array.getPtr()Temporarily access the referencedRagdollSettings.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.longtargetVa()Return the address of the nativeRagdollSettings.toRef()Create another counted reference to the nativeRagdollSettings.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, toString, va
-
Constructor Details
-
RagdollSettingsRef
public RagdollSettingsRef()Instantiate an empty reference.
-
-
Method Details
-
addAdditionalConstraint
Add the specified constraint.- Parameters:
constraint- (not null)
-
calculateBodyIndexToConstraintIndex
public void calculateBodyIndexToConstraintIndex()Pre-calculate the map used bygetBodyIndexToConstraintIndex(). -
calculateConstraintIndexToBodyIdxPair
public void calculateConstraintIndexToBodyIdxPair()Pre-calculate the map used bygetConstraintIndexToBodyIdxPair(). -
createRagdoll
Generate a ragdoll instance from the settings, which are unaffected.- Parameters:
groupId- the collision group for the bodiesuserData- the desired user-data valuephysicsSystem- where to add the bodies and constraints (not null, modified)- Returns:
- a new ragdoll instance, or
nullwhen out of bodies
-
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
-
getSkeleton
Access the skeleton. (native attribute: mSkeleton)- Returns:
- a new JVM object with the pre-existing native object assigned
-
resizeParts
public void resizeParts(int numParts) Resize the parts array.- Parameters:
numParts- the desired number of parts (≥0)
-
saveBinaryState
Save the settings to the specified binary stream. The settings are unaffected.- Parameters:
stream- the stream to write to (not null)saveShapes- if true, save the shapessaveGroupFilter- if true, save the group filter
-
setSkeleton
Replace the skeleton. (native attribute: mSkeleton)- Parameters:
skeleton- the desired skeleton (not null)
-
sRestoreFromBinaryState
Read a ragdoll from the specified input stream.- Parameters:
stream- the stream to read from (not null)- Returns:
- the result of the read (not null)
-
stabilize
public boolean stabilize()Stabilize the constraints.- Returns:
trueif successful, otherwisefalse
-
getPtr
Temporarily access the referencedRagdollSettings. -
targetVa
public long targetVa()Return the address of the nativeRagdollSettings. No objects are affected.- Specified by:
targetVain interfaceConstJoltPhysicsObject- Overrides:
targetVain classJoltPhysicsObject- Returns:
- a virtual address (not zero)
-
toRef
Create another counted reference to the nativeRagdollSettings.
-