java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.Ragdoll
- All Implemented Interfaces:
ConstJoltPhysicsObject
,RefTarget
,AutoCloseable
,Comparable<JoltPhysicsObject>
Runtime information to simulate a ragdoll composed of bodies connected by
constraints.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addToPhysicsSystem
(EActivation activation) Add bodies and constraints to the physics system and optionally activate the bodies.void
driveToPoseUsingKinematics
(SkeletonPose pose, float time) Drive the ragdoll to the specified pose by setting velocities.void
driveToPoseUsingKinematics
(SkeletonPose pose, float time, boolean lockBodies) Drive the ragdoll to the specified pose by setting velocities.void
Drive the ragdoll to the specified pose using motors.int
Count how many bodies are in the ragdoll, which is unaffectedint[]
Enumerate all bodies in the ragdoll, which is unaffected.int
Count how many constraints are in the ragdoll, which is unaffected.void
getPose
(RVec3 storeRootOffset, Mat44Array storeJointMatrices) Copy the low-level pose using a locking body interface.void
getPose
(RVec3 storeRootOffset, Mat44Array storeJointMatrices, boolean lockBodies) Copy the low-level pose.int
Count the active references to the nativeRagdoll
.void
getRootTransform
(RVec3 storeLocation, Quat storeOrientation) Copy the transform of the ragdoll's root, using the locking body interface.void
getRootTransform
(RVec3 storeLocation, Quat storeOrientation, boolean lockBodies) Copy the transform of the ragdoll's root.void
Remove bodies and constraints from the physics system.void
Mark the nativeRagdoll
as embedded.void
setPose
(SkeletonPose pose) Alter the ragdoll's pose using the locking body interface.void
setPose
(SkeletonPose pose, boolean lockBodies) Alter the ragdoll's pose.toRef()
Create a counted reference to the nativeRagdoll
.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Method Details
-
addToPhysicsSystem
Add bodies and constraints to the physics system and optionally activate the bodies.- Parameters:
activation
- whether to activate bodies (not null)
-
driveToPoseUsingKinematics
Drive the ragdoll to the specified pose by setting velocities.- Parameters:
pose
- the desired posetime
- time to achieve the pose (in seconds)
-
driveToPoseUsingKinematics
Drive the ragdoll to the specified pose by setting velocities.- Parameters:
pose
- the desired posetime
- time to achieve the pose (in seconds)lockBodies
- (default=true)
-
driveToPoseUsingMotors
Drive the ragdoll to the specified pose using motors.- Parameters:
pose
- the desired pose (not null, unaffected)
-
getBodyCount
public int getBodyCount()Count how many bodies are in the ragdoll, which is unaffected- Returns:
- the count (≥0)
-
getBodyIds
public int[] getBodyIds()Enumerate all bodies in the ragdoll, which is unaffected. (native method: GetBodyIDs)- Returns:
- a new array of body IDs
-
getConstraintCount
public int getConstraintCount()Count how many constraints are in the ragdoll, which is unaffected.- Returns:
- the count (≥0)
-
getPose
Copy the low-level pose using a locking body interface.- Parameters:
storeRootOffset
- storage for the root offset (not null, modified)storeJointMatrices
- storage for the joint matrices (not null, modified)
-
getPose
Copy the low-level pose.- Parameters:
storeRootOffset
- storage for the root offset (not null, modified)storeJointMatrices
- storage for the joint matrices (not null, modified)lockBodies
-true
→ use the locking body interface,false
→ use the non-locking body interface (default=true)
-
getRootTransform
Copy the transform of the ragdoll's root, using the locking body interface. The ragdoll is unaffected.- Parameters:
storeLocation
- storage for the root location (not null, modified)storeOrientation
- storage for the root orientation (not null, modified)
-
getRootTransform
Copy the transform of the ragdoll's root. The ragdoll is unaffected.- Parameters:
storeLocation
- storage for the root location (not null, modified)storeOrientation
- storage for the root orientation (not null, modified)lockBodies
-true
→ use the locking body interface,false
→ use the non-locking body interface (default=true)
-
removeFromPhysicsSystem
public void removeFromPhysicsSystem()Remove bodies and constraints from the physics system. -
setPose
Alter the ragdoll's pose using the locking body interface.- Parameters:
pose
- the desired pose (not null, unaffected)
-
setPose
Alter the ragdoll's pose.- Parameters:
pose
- the desired pose (not null, unaffected)lockBodies
- true→use the locking body interface, false→use the non-locking body interface
-
getRefCount
public int getRefCount()Count the active references to the nativeRagdoll
. The ragdoll is unaffected.- Specified by:
getRefCount
in interfaceRefTarget
- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeRagdoll
as embedded.- Specified by:
setEmbedded
in interfaceRefTarget
-
toRef
Create a counted reference to the nativeRagdoll
.
-