java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.RagdollSettings
- All Implemented Interfaces:
ConstJoltPhysicsObject,RefTarget,AutoCloseable,Comparable<JoltPhysicsObject>
Settings and structure used to create a
Ragdoll.-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate default settings.RagdollSettings(RagdollSettings original) Instantiate a copy of the specified settings. -
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.intCount the active references to the nativeRagdollSettings.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.voidMark the nativeRagdollSettingsas embedded.voidsetSkeleton(Skeleton skeleton) Replace the skeleton.static RagdollResultsRestoreFromBinaryState(StreamIn stream) Read a ragdoll from the specified input stream.booleanStabilize the constraints.toRef()Create a 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, targetVa, toString, va
-
Constructor Details
-
RagdollSettings
public RagdollSettings()Instantiate default settings. -
RagdollSettings
Instantiate a copy of the specified settings.- Parameters:
original- the settings to copy (notnull, unaffected)
-
-
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
-
getRefCount
public int getRefCount()Count the active references to the nativeRagdollSettings. The settings are unaffected.- Specified by:
getRefCountin interfaceRefTarget- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeRagdollSettingsas embedded.- Specified by:
setEmbeddedin interfaceRefTarget
-
toRef
Create a counted reference to the nativeRagdollSettings.
-