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. | |
~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. | |
TwoBodyConstraint * | GetConstraint (int inConstraintIndex) |
Access a constraint by index. | |
const TwoBodyConstraint * | GetConstraint (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 RagdollSettings * | GetRagdollSettings () 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 |
RefTarget & | operator= (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< uint32 > | mRefCount |
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. | |
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.