Jolt Physics
A multi core friendly Game Physics Engine
|
Runtime ragdoll information. More...
#include <Ragdoll.h>
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... | |
bool | IsActive (bool inLockBodies=true) const |
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 | ResetWarmStart () |
This function calls ResetWarmStart on all constraints. It can be used after calling SetPose to reset previous frames impulses. See: Constraint::ResetWarmStart. 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... | |
TwoBodyConstraint * | GetConstraint (int inConstraintIndex) |
Access a constraint by index. More... | |
const TwoBodyConstraint * | GetConstraint (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 RagdollSettings * | GetRagdollSettings () 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 |
RefTarget & | operator= (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< uint32 > | mRefCount |
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... | |
Runtime ragdoll information.
|
inlineexplicit |
Constructor.
Ragdoll::~Ragdoll | ( | ) |
Destructor.
void Ragdoll::Activate | ( | bool | inLockBodies = true | ) |
Wake up all bodies in the ragdoll.
void Ragdoll::AddImpulse | ( | Vec3Arg | inImpulse, |
bool | inLockBodies = true |
||
) |
Add impulse to all bodies of the ragdoll (center of mass of each of them)
void Ragdoll::AddLinearVelocity | ( | Vec3Arg | inLinearVelocity, |
bool | inLockBodies = true |
||
) |
Add a world space velocity (in m/s) to all bodies in the ragdoll.
void Ragdoll::AddToPhysicsSystem | ( | EActivation | inActivationMode, |
bool | inLockBodies = true |
||
) |
Add bodies and constraints to the system and optionally activate the bodies.
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.
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.
void Ragdoll::DriveToPoseUsingMotors | ( | const SkeletonPose & | inPose | ) |
Drive the ragdoll to a specific pose by activating the motors on each constraint.
|
inline |
Get number of bodies in the ragdoll.
|
inline |
Access a body ID.
|
inline |
Access a constraint by index.
|
inline |
Access a constraint by index.
|
inline |
Get number of constraints in the ragdoll.
Lower level version of GetPose that directly returns the world space joint matrices.
void Ragdoll::GetPose | ( | SkeletonPose & | outPose, |
bool | inLockBodies = true |
||
) |
Get the ragdoll pose (uses the world transform of the bodies to calculate the pose)
|
inline |
Get the settings object that created this ragdoll.
void Ragdoll::GetRootTransform | ( | RVec3 & | outPosition, |
Quat & | outRotation, | ||
bool | inLockBodies = true |
||
) | const |
Get the position and orientation of the root of the ragdoll.
AABox Ragdoll::GetWorldSpaceBounds | ( | bool | inLockBodies = true | ) | const |
Get world space bounding box for all bodies of the ragdoll.
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).
void Ragdoll::RemoveFromPhysicsSystem | ( | bool | inLockBodies = true | ) |
Remove bodies and constraints from the system.
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.
void Ragdoll::SetGroupID | ( | CollisionGroup::GroupID | inGroupID, |
bool | inLockBodies = true |
||
) |
Set the group ID on all bodies in the ragdoll.
void Ragdoll::SetLinearAndAngularVelocity | ( | Vec3Arg | inLinearVelocity, |
Vec3Arg | inAngularVelocity, | ||
bool | inLockBodies = true |
||
) |
Control the linear and velocity of all bodies in the ragdoll.
void Ragdoll::SetLinearVelocity | ( | Vec3Arg | inLinearVelocity, |
bool | inLockBodies = true |
||
) |
Set the world space linear velocity of all bodies in the ragdoll.
void Ragdoll::SetPose | ( | const SkeletonPose & | inPose, |
bool | inLockBodies = true |
||
) |
Set the ragdoll to a pose (calls BodyInterface::SetPositionAndRotation to instantly move the ragdoll)
void Ragdoll::SetPose | ( | RVec3Arg | inRootOffset, |
const Mat44 * | inJointMatrices, | ||
bool | inLockBodies = true |
||
) |
Lower level version of SetPose that directly takes the world space joint matrices.
|
friend |
For RagdollSettings::CreateRagdoll function.