BodyRigid
The BodyRigid class represents a physics rigid body. It supports independent locking of linear and angular axes. The body inertia tensor can be derived from shapes or overridden manually. The class provides access to physical parameters such as forces and velocities.
#include <scene/TellusimBodyRigid.h>
Inheritance
- Inherits from Body
Constructors
explicit BodyRigid(const char *name = nullptr)
explicit BodyRigid(Scene &scene, const char *name = nullptr)
explicit BodyRigid(NodeObject &node, const char *name = nullptr)
Methods
Body flags.
void setFlags(Flags flags)
Flags getFlags() const
bool hasFlag(Flags flags) const
bool hasFlags(Flags flags) const
String getFlagsName() const
Body mass.
void setMass(float32_t mass)
float32_t getMass() const
float32_t getIMass() const
Inertia tensor and center of mass.
void setInertia(Matrix4x3f inertia, bool atomic = false)
const Matrix4x3f getInertia() const
const Matrix4x3f getIInertia() const
Update body mass.
void updateMass(bool update = false)
Add force to the center of mass.
void addForce(Vector3f force, bool atomic = false)
void addTorque(Vector3f torque, bool atomic = false)
const Vector3f getForce() const
const Vector3f getTorque() const
Add impulse to the center of mass.
void addLinearImpulse(Vector3f impulse, bool atomic = false)
void addAngularImpulse(Vector3f impulse, bool atomic = false)
const Vector3f getLinearDelta() const
const Vector3f getAngularDelta() const
Linear velocity.
void setLinearVelocity(Vector3f velocity, bool force = false, bool atomic = false)
const Vector3f getLinearVelocity() const
Angular velocity.
void setAngularVelocity(Vector3f velocity, bool force = false, bool atomic = false)
const Vector3f getAngularVelocity() const
Maximum linear velocity.
void setMaxLinearVelocity(Vector3f velocity, bool force = false, bool atomic = false)
const Vector3f getMaxLinearVelocity() const
Maximum angular velocity.
void setMaxAngularVelocity(Vector3f velocity, bool force = false, bool atomic = false)
const Vector3f getMaxAngularVelocity() const
Body position.
void setPosition(Vector3d position, bool force = false, bool atomic = false)
const Vector3d getPosition() const
Body rotation.
void setRotation(Quaternionf rotation, bool force = false, bool atomic = false)
const Quaternionf getRotation() const
Body transform.
void setTransform(Matrix4x3d transform, bool force = false, bool atomic = false)
Matrix4x3d getTransform() const
Updated flags.
bool isForceUpdated() const
bool isDeltaUpdated() const
bool isVelocityUpdated() const
bool isTransformUpdated() const
Enums
Flags
Name | Value | Description |
---|---|---|
FlagNone | 0 | |
FlagLinearLockX | (1 << 0) | Linear X axis lock. |
FlagLinearLockY | (1 << 1) | Linear Y axis lock. |
FlagLinearLockZ | (1 << 2) | Linear Z axis lock. |
FlagAngularLockX | (1 << 3) | Angular X axis lock. |
FlagAngularLockY | (1 << 4) | Angular Y axis lock. |
FlagAngularLockZ | (1 << 5) | Angular Z axis lock. |
FlagKeepAwake | (1 << 6) | Prevent body from sleeping. |
FlagOverrideMass | (1 << 7) | Override mass and inertia. |
FlagLinearLockXYZ | (FlagLinearLockX | FlagLinearLockY | FlagLinearLockZ) | |
FlagAngularLockXYZ | (FlagAngularLockX | FlagAngularLockY | FlagAngularLockZ) |