RigidBody

Inherited: Collider

Description

The RigidBody class provides a flexible interface for managing dynamic rigid bodies in a physics simulation. It supports mass, kinematic properties, locking of positions and rotations, and synchronization with custom collider components.

Public Methods

void

applyForce (const Vector3 & force, const Vector3 & point)

void

applyImpulse (const Vector3 & impulse, const Vector3 & point)

void

createCollider ()

bool

kinematic () const

int

lockPosition () const

int

lockRotation () const

float

mass () const

PhysicMaterial *

material () const

void

setEnabled (bool enable)

void

setKinematic (bool kinematic)

void

setLockPosition (int flags)

void

setLockRotation (int flags)

void

setMass (float mass)

void

updateCollider (bool updated)

Static Methods

None

Methods Description

void RigidBody::applyForce (Vector3 & force, Vector3 & point)

Applies a force to the rigid body at a specific point.


void RigidBody::applyImpulse (Vector3 & impulse, Vector3 & point)

Applies an impulse to the rigid body at a specific point.


void RigidBody::createCollider ()

Reimplements: Collider::createCollider().

Creates the rigid body’s collider in the physics world.


bool RigidBody::kinematic () const

Returns true if the rigid body is kinematic, false otherwise.

See also setKinematic().


int RigidBody::lockPosition () const

Returns the lock flags for the rigid body’s linear position.

See also setLockPosition().


int RigidBody::lockRotation () const

Returns the lock flags for the rigid body’s rotation.

See also setLockRotation().


float RigidBody::mass () const

Returns the mass of the rigid body.

See also setMass().


:ref:`PhysicMaterial<api_PhysicMaterial>`* RigidBody::material () const

Returns the physical material associated with the rigid body.


void RigidBody::setEnabled (bool enable)

Reimplements: Component::setEnabled(bool *enable*d).

Set enable or disable the rigid body in the physics world.


void RigidBody::setKinematic (bool kinematic)

Sets whether the rigid body is kinematic or not.

See also *kinematic*().


void RigidBody::setLockPosition (int flags)

Sets the lock flags for the rigid body’s linear position.

See also lockPosition().


void RigidBody::setLockRotation (int flags)

Sets the lock flags for the rigid body’s rotation.

See also lockRotation().


void RigidBody::setMass (float mass)

Sets the mass of the rigid body and updates its properties in the physics simulation.

See also *mass*().


void RigidBody::updateCollider (bool updated)

Updates the rigid body’s collider based on the associated collider components. Parameter updated can be used to forcibly update.