Jolt Physics
A multi core friendly Game Physics Engine
|
#include <Character.h>
Runtime character object. This object usually represents the player or a humanoid AI. It uses a single rigid body, usually with a capsule shape to simulate movement and collision for the character. The character is a keyframed object, the application controls it by setting the velocity.
Character::Character | ( | const CharacterSettings * | inSettings, |
RVec3Arg | inPosition, | ||
QuatArg | inRotation, | ||
uint64 | inUserData, | ||
PhysicsSystem * | inSystem ) |
Constructor
inSettings | The settings for the character |
inPosition | Initial position for the character |
inRotation | Initial rotation for the character (usually only around Y) |
inUserData | Application specific value |
inSystem | Physics system that this character will be added to later |
|
overridevirtual |
Destructor.
Add impulse to the center of mass of the character.
Add world space linear velocity to current velocity (m / s)
void Character::AddToPhysicsSystem | ( | EActivation | inActivationMode = EActivation::Activate, |
bool | inLockBodies = true ) |
Add bodies and constraints to the system and optionally activate the bodies.
void Character::CheckCollision | ( | RVec3Arg | inPosition, |
QuatArg | inRotation, | ||
Vec3Arg | inMovementDirection, | ||
float | inMaxSeparationDistance, | ||
const Shape * | inShape, | ||
RVec3Arg | inBaseOffset, | ||
CollideShapeCollector & | ioCollector, | ||
bool | inLockBodies = true ) const |
Get all contacts for the character at a particular location.
inPosition | Position to test. |
inRotation | Rotation at which to test the shape. |
inMovementDirection | A hint in which direction the character is moving, will be used to calculate a proper normal. |
inMaxSeparationDistance | How much distance around the character you want to report contacts in (can be 0 to match the character exactly). |
inShape | Shape to test collision with. |
inBaseOffset | All hit results will be returned relative to this offset, can be zero to get results in world position, but when you're testing far from the origin you get better precision by picking a position that's closer e.g. GetPosition() since floats are most accurate near the origin |
ioCollector | Collision collector that receives the collision results. |
inLockBodies | If the collision query should use the locking body interface (true) or the non locking body interface (false) |
|
inline |
Get the body associated with this character.
Position of the center of mass of the underlying rigid body.
Get the linear velocity of the character (m / s)
void Character::GetPositionAndRotation | ( | RVec3 & | outPosition, |
Quat & | outRotation, | ||
bool | inLockBodies = true ) const |
Get position / rotation of the body.
Calculate the world transform of the character.
Needs to be called after every PhysicsSystem::Update
inMaxSeparationDistance | Max distance between the floor and the character to still consider the character standing on the floor |
inLockBodies | If the collision query should use the locking body interface (true) or the non locking body interface (false) |
Remove bodies and constraints from the system.
void Character::SetLayer | ( | ObjectLayer | inLayer, |
bool | inLockBodies = true ) |
Update the layer of the character.
void Character::SetLinearAndAngularVelocity | ( | Vec3Arg | inLinearVelocity, |
Vec3Arg | inAngularVelocity, | ||
bool | inLockBodies = true ) |
Control the velocity of the character.
Set the linear velocity of the character (m / s)
void Character::SetPosition | ( | RVec3Arg | inPostion, |
EActivation | inActivationMode = EActivation::Activate, | ||
bool | inLockBodies = true ) |
Set the position of the character, optionally activating it.
void Character::SetPositionAndRotation | ( | RVec3Arg | inPosition, |
QuatArg | inRotation, | ||
EActivation | inActivationMode = EActivation::Activate, | ||
bool | inLockBodies = true ) const |
Set the position / rotation of the body, optionally activating it.
void Character::SetRotation | ( | QuatArg | inRotation, |
EActivation | inActivationMode = EActivation::Activate, | ||
bool | inLockBodies = true ) |
Set the rotation of the character, optionally activating it.
bool Character::SetShape | ( | const Shape * | inShape, |
float | inMaxPenetrationDepth, | ||
bool | inLockBodies = true ) |
Switch the shape of the character (e.g. for stance). When inMaxPenetrationDepth is not FLT_MAX, it checks if the new shape collides before switching shape. Returns true if the switch succeeded.