Package com.github.stephengold.joltjni
Class RagdollSettings
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.RagdollSettings
- All Implemented Interfaces:
ConstJoltPhysicsObject,RefTarget,AutoCloseable,Comparable<ConstJoltPhysicsObject>
Settings and structure used to create a
Ragdoll.-
Method Summary
Modifier and TypeMethodDescriptionvoidPre-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.Part[]getParts()Access the parts by way of a Java array.intCount the active references to the nativeRagdollSettings.Access the skeleton.voidMark the nativeRagdollSettingsas embedded.booleanStabilize the constraints.toRef()Create a counted reference to the nativeRagdollSettings.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, startCleaner, toString, va
-
Method Details
-
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.- 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
-
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
-
stabilize
public boolean stabilize()Stabilize the constraints.- Returns:
- true if successful, otherwise false
-
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.
-