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

Additional Inherited Members

- Static Public Member Functions inherited from RefTarget< Ragdoll >
static int sInternalGetRefCountOffset ()
 INTERNAL HELPER FUNCTION USED BY SERIALIZATION. More...
 
- Protected Attributes inherited from RefTarget< Ragdoll >
atomic< uint32mRefCount
 Current reference count. More...
 
- 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. More...
 

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.

◆ RemoveFromPhysicsSystem()

void Ragdoll::RemoveFromPhysicsSystem ( bool  inLockBodies = true)

Remove bodies and constraints from the system.

◆ 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 Function Documentation

◆ RagdollSettings

friend class RagdollSettings
friend

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