Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
Ragdoll Class Reference

Runtime ragdoll information. More...

#include <Ragdoll.h>

Inheritance diagram for Ragdoll:
RefTarget< Ragdoll > NonCopyable

Public Member Functions

JPH_OVERRIDE_NEW_DELETE Ragdoll (PhysicsSystem *inSystem)
 Constructor.
 
 ~Ragdoll ()
 Destructor.
 
void AddToPhysicsSystem (EActivation inActivationMode, bool inLockBodies=true)
 Add bodies and constraints to the system and optionally activate the bodies.
 
void RemoveFromPhysicsSystem (bool inLockBodies=true)
 Remove bodies and constraints from the system.
 
void Activate (bool inLockBodies=true)
 Wake up all bodies in the ragdoll.
 
bool IsActive (bool inLockBodies=true) const
 
void SetGroupID (CollisionGroup::GroupID inGroupID, bool inLockBodies=true)
 Set the group ID on all bodies in the ragdoll.
 
void SetPose (const SkeletonPose &inPose, bool inLockBodies=true)
 Set the ragdoll to a pose (calls BodyInterface::SetPositionAndRotation to instantly move the ragdoll)
 
void SetPose (RVec3Arg inRootOffset, const Mat44 *inJointMatrices, bool inLockBodies=true)
 Lower level version of SetPose that directly takes the world space joint matrices.
 
void GetPose (SkeletonPose &outPose, bool inLockBodies=true)
 Get the ragdoll pose (uses the world transform of the bodies to calculate the pose)
 
void GetPose (RVec3 &outRootOffset, Mat44 *outJointMatrices, bool inLockBodies=true)
 Lower level version of GetPose that directly returns the world space joint matrices.
 
void ResetWarmStart ()
 This function calls ResetWarmStart on all constraints. It can be used after calling SetPose to reset previous frames impulses. See: Constraint::ResetWarmStart.
 
void DriveToPoseUsingKinematics (const SkeletonPose &inPose, float inDeltaTime, bool inLockBodies=true)
 Drive the ragdoll to a specific pose by setting velocities on each of the bodies so that it will reach inPose in inDeltaTime.
 
void DriveToPoseUsingKinematics (RVec3Arg inRootOffset, const Mat44 *inJointMatrices, float inDeltaTime, bool inLockBodies=true)
 Lower level version of DriveToPoseUsingKinematics that directly takes the world space joint matrices.
 
void DriveToPoseUsingMotors (const SkeletonPose &inPose)
 Drive the ragdoll to a specific pose by activating the motors on each constraint.
 
void SetLinearAndAngularVelocity (Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity, bool inLockBodies=true)
 Control the linear and velocity of all bodies in the ragdoll.
 
void SetLinearVelocity (Vec3Arg inLinearVelocity, bool inLockBodies=true)
 Set the world space linear velocity of all bodies in the ragdoll.
 
void AddLinearVelocity (Vec3Arg inLinearVelocity, bool inLockBodies=true)
 Add a world space velocity (in m/s) to all bodies in the ragdoll.
 
void AddImpulse (Vec3Arg inImpulse, bool inLockBodies=true)
 Add impulse to all bodies of the ragdoll (center of mass of each of them)
 
void GetRootTransform (RVec3 &outPosition, Quat &outRotation, bool inLockBodies=true) const
 Get the position and orientation of the root of the ragdoll.
 
size_t GetBodyCount () const
 Get number of bodies in the ragdoll.
 
BodyID GetBodyID (int inBodyIndex) const
 Access a body ID.
 
const Array< BodyID > & GetBodyIDs () const
 Access to the array of body IDs.
 
size_t GetConstraintCount () const
 Get number of constraints in the ragdoll.
 
TwoBodyConstraintGetConstraint (int inConstraintIndex)
 Access a constraint by index.
 
const TwoBodyConstraintGetConstraint (int inConstraintIndex) const
 Access a constraint by index.
 
AABox GetWorldSpaceBounds (bool inLockBodies=true) const
 Get world space bounding box for all bodies of the ragdoll.
 
const RagdollSettingsGetRagdollSettings () const
 Get the settings object that created this ragdoll.
 
- Public Member Functions inherited from RefTarget< Ragdoll >
 RefTarget ()=default
 Constructor.
 
 RefTarget (const RefTarget &)
 
 ~RefTarget ()
 assert no one is referencing us
 
void SetEmbedded () const
 
RefTargetoperator= (const RefTarget &)
 Assignment operator.
 
uint32 GetRefCount () const
 Get current refcount of this object.
 
void AddRef () const
 Add or release a reference to this object.
 
void Release () const
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Friends

class RagdollSettings
 For RagdollSettings::CreateRagdoll function.
 

Additional Inherited Members

- Static Public Member Functions inherited from RefTarget< Ragdoll >
static int sInternalGetRefCountOffset ()
 INTERNAL HELPER FUNCTION USED BY SERIALIZATION.
 
- Protected Attributes inherited from RefTarget< Ragdoll >
atomic< uint32mRefCount
 Current reference count.
 
- Static Protected Attributes inherited from RefTarget< Ragdoll >
static constexpr uint32 cEmbedded
 A large value that gets added to the refcount to mark the object as embedded.
 

Detailed Description

Runtime ragdoll information.

Constructor & Destructor Documentation

◆ Ragdoll()

JPH_OVERRIDE_NEW_DELETE Ragdoll::Ragdoll ( PhysicsSystem inSystem)
inlineexplicit

Constructor.

◆ ~Ragdoll()

Ragdoll::~Ragdoll ( )

Destructor.

Member Function Documentation

◆ Activate()

void Ragdoll::Activate ( bool  inLockBodies = true)

Wake up all bodies in the ragdoll.

◆ AddImpulse()

void Ragdoll::AddImpulse ( Vec3Arg  inImpulse,
bool  inLockBodies = true 
)

Add impulse to all bodies of the ragdoll (center of mass of each of them)

◆ AddLinearVelocity()

void Ragdoll::AddLinearVelocity ( Vec3Arg  inLinearVelocity,
bool  inLockBodies = true 
)

Add a world space velocity (in m/s) to all bodies in the ragdoll.

◆ AddToPhysicsSystem()

void Ragdoll::AddToPhysicsSystem ( EActivation  inActivationMode,
bool  inLockBodies = true 
)

Add bodies and constraints to the system and optionally activate the bodies.

◆ DriveToPoseUsingKinematics() [1/2]

void Ragdoll::DriveToPoseUsingKinematics ( const SkeletonPose inPose,
float  inDeltaTime,
bool  inLockBodies = true 
)

Drive the ragdoll to a specific pose by setting velocities on each of the bodies so that it will reach inPose in inDeltaTime.

◆ DriveToPoseUsingKinematics() [2/2]

void Ragdoll::DriveToPoseUsingKinematics ( RVec3Arg  inRootOffset,
const Mat44 inJointMatrices,
float  inDeltaTime,
bool  inLockBodies = true 
)

Lower level version of DriveToPoseUsingKinematics that directly takes the world space joint matrices.

◆ DriveToPoseUsingMotors()

void Ragdoll::DriveToPoseUsingMotors ( const SkeletonPose inPose)

Drive the ragdoll to a specific pose by activating the motors on each constraint.

◆ GetBodyCount()

size_t Ragdoll::GetBodyCount ( ) const
inline

Get number of bodies in the ragdoll.

◆ GetBodyID()

BodyID Ragdoll::GetBodyID ( int  inBodyIndex) const
inline

Access a body ID.

◆ GetBodyIDs()

const Array< BodyID > & Ragdoll::GetBodyIDs ( ) const
inline

Access to the array of body IDs.

◆ GetConstraint() [1/2]

TwoBodyConstraint * Ragdoll::GetConstraint ( int  inConstraintIndex)
inline

Access a constraint by index.

◆ GetConstraint() [2/2]

const TwoBodyConstraint * Ragdoll::GetConstraint ( int  inConstraintIndex) const
inline

Access a constraint by index.

◆ GetConstraintCount()

size_t Ragdoll::GetConstraintCount ( ) const
inline

Get number of constraints in the ragdoll.

◆ GetPose() [1/2]

void Ragdoll::GetPose ( RVec3 outRootOffset,
Mat44 outJointMatrices,
bool  inLockBodies = true 
)

Lower level version of GetPose that directly returns the world space joint matrices.

◆ GetPose() [2/2]

void Ragdoll::GetPose ( SkeletonPose outPose,
bool  inLockBodies = true 
)

Get the ragdoll pose (uses the world transform of the bodies to calculate the pose)

◆ GetRagdollSettings()

const RagdollSettings * Ragdoll::GetRagdollSettings ( ) const
inline

Get the settings object that created this ragdoll.

◆ GetRootTransform()

void Ragdoll::GetRootTransform ( RVec3 outPosition,
Quat outRotation,
bool  inLockBodies = true 
) const

Get the position and orientation of the root of the ragdoll.

◆ GetWorldSpaceBounds()

AABox Ragdoll::GetWorldSpaceBounds ( bool  inLockBodies = true) const

Get world space bounding box for all bodies of the ragdoll.

◆ IsActive()

bool Ragdoll::IsActive ( bool  inLockBodies = true) const

Check if one or more of the bodies in the ragdoll are active. Note that this involves locking the bodies (if inLockBodies is true) and looping over them. An alternative and possibly faster way could be to install a BodyActivationListener and count the number of active bodies of a ragdoll as they're activated / deactivated (basically check if the body that activates / deactivates is in GetBodyIDs() and increment / decrement a counter).

◆ RemoveFromPhysicsSystem()

void Ragdoll::RemoveFromPhysicsSystem ( bool  inLockBodies = true)

Remove bodies and constraints from the system.

◆ ResetWarmStart()

void Ragdoll::ResetWarmStart ( )

This function calls ResetWarmStart on all constraints. It can be used after calling SetPose to reset previous frames impulses. See: Constraint::ResetWarmStart.

◆ SetGroupID()

void Ragdoll::SetGroupID ( CollisionGroup::GroupID  inGroupID,
bool  inLockBodies = true 
)

Set the group ID on all bodies in the ragdoll.

◆ SetLinearAndAngularVelocity()

void Ragdoll::SetLinearAndAngularVelocity ( Vec3Arg  inLinearVelocity,
Vec3Arg  inAngularVelocity,
bool  inLockBodies = true 
)

Control the linear and velocity of all bodies in the ragdoll.

◆ SetLinearVelocity()

void Ragdoll::SetLinearVelocity ( Vec3Arg  inLinearVelocity,
bool  inLockBodies = true 
)

Set the world space linear velocity of all bodies in the ragdoll.

◆ SetPose() [1/2]

void Ragdoll::SetPose ( const SkeletonPose inPose,
bool  inLockBodies = true 
)

Set the ragdoll to a pose (calls BodyInterface::SetPositionAndRotation to instantly move the ragdoll)

◆ SetPose() [2/2]

void Ragdoll::SetPose ( RVec3Arg  inRootOffset,
const Mat44 inJointMatrices,
bool  inLockBodies = true 
)

Lower level version of SetPose that directly takes the world space joint matrices.

Friends And Related Symbol Documentation

◆ RagdollSettings

friend class RagdollSettings
friend

The documentation for this class was generated from the following files: