Rapier C — 2D / f32 0.36.0+c.0
Loading...
Searching...
No Matches
Rigid bodies

Descriptions and live, world-bound handles. More...

Data Structures

struct  R2RigidBodyHandle
 Copyable non-owning handle: world pointer plus entity index and generation. More...
struct  R2RigidBodyDesc
 Stack-allocated rigid-body construction data. More...
struct  R2RigidBodyState
 A copied state snapshot, with no pointers or ownership obligations. More...

Macros

#define R2_DYNAMIC   0
 Dynamic body affected by forces and contacts.
#define R2_FIXED   1
 Immovable body.
#define R2_KINEMATIC_POSITION_BASED   2
 Kinematic body controlled by its next pose.
#define R2_KINEMATIC_VELOCITY_BASED   3
 Kinematic body controlled by its velocity.
#define R2_LOCK_TRANSLATION_X   1
 Rigid-body lock bit: translation x.
#define R2_LOCK_TRANSLATION_Y   2
 Rigid-body lock bit: translation y.
#define R2_LOCK_TRANSLATION_Z   4
 Rigid-body lock bit: translation z.
#define R2_LOCK_ROTATION_X   8
 Rigid-body lock bit: rotation x.
#define R2_LOCK_ROTATION_Y   16
 Rigid-body lock bit: rotation y.
#define R2_LOCK_ROTATION_Z   32
 Rigid-body lock bit: rotation z.

Typedefs

typedef struct R2RigidBodyHandle R2RigidBodyHandle
 Copyable non-owning handle: world pointer plus entity index and generation.
typedef struct R2RigidBodyDesc R2RigidBodyDesc
 Stack-allocated rigid-body construction data.
typedef struct R2RigidBodyState R2RigidBodyState
 A copied state snapshot, with no pointers or ownership obligations.

Functions

struct R2RigidBodyDesc r2DynamicRigidBodyDesc (void)
 Return a dynamic rigid-body description with native defaults; no allocation.
struct R2RigidBodyDesc r2FixedRigidBodyDesc (void)
 Return a fixed rigid-body description with native defaults; no allocation.
struct R2RigidBodyDesc r2KinematicPositionBasedRigidBodyDesc (void)
 Return a kinematic position based rigid-body description with native defaults; no allocation.
struct R2RigidBodyDesc r2KinematicVelocityBasedRigidBodyDesc (void)
 Return a kinematic velocity based rigid-body description with native defaults; no allocation.
struct R2RigidBodyHandle r2InsertRigidBody (struct R2World *world, const struct R2RigidBodyDesc *desc)
 Create a body from the description and return its world-bound handle.
R2Status r2RigidBodyPropagateModifiedBodyPositionsToColliders (struct R2World *world)
 Propagate all modified body poses to attached colliders.
R2Status r2RigidBody_WakeUp (struct R2RigidBodyHandle handle, R2Bool strong)
 Wake a body by handle, including a soft-body cluster proxy.
size_t r2RigidBodyCount (const struct R2World *world)
 Return the number of rigid body objects in the world.
size_t r2RigidBodyHandles (const struct R2World *world, struct R2RigidBodyHandle *buffer, size_t capacity)
 Copy entity handles.
R2Bool r2RigidBody_Contains (struct R2RigidBodyHandle handle)
 Test whether the live world contains this rigid body handle.
R2Status r2RemoveRigidBody (struct R2RigidBodyHandle handle, R2Bool remove_attached_colliders)
 Remove a body and its joints, optionally keeping colliders as standalone objects.
struct R2Pose r2RigidBody_Position (struct R2RigidBodyHandle handle)
 Return the rigid body world-space pose.
struct R2Vector r2RigidBody_Translation (struct R2RigidBodyHandle handle)
 Return the rigid body world-space translation.
struct R2Vector r2RigidBody_Linvel (struct R2RigidBodyHandle handle)
 Return the rigid body world-space linear velocity.
R2AngVector r2RigidBody_Angvel (struct R2RigidBodyHandle handle)
 Return the rigid body world-space angular velocity (radians per second).
R2Bool r2RigidBody_IsSleeping (struct R2RigidBodyHandle handle)
 Return whether the rigid body is sleeping.
R2Bool r2RigidBody_IsEnabled (struct R2RigidBodyHandle handle)
 Return whether the rigid body is enabled.
struct R2UserData r2RigidBody_UserData (struct R2RigidBodyHandle handle)
 Return the rigid body application-owned 128-bit user value.
R2Status r2RigidBody_SetPosition (struct R2RigidBodyHandle handle, struct R2Pose value, R2Bool wake_up)
 Set the rigid body world-space pose.
R2Status r2RigidBody_SetTranslation (struct R2RigidBodyHandle handle, struct R2Vector value, R2Bool wake_up)
 Set the rigid body world-space translation.
R2Status r2RigidBody_SetLinvel (struct R2RigidBodyHandle handle, struct R2Vector value, R2Bool wake_up)
 Set the rigid body world-space linear velocity.
R2Status r2RigidBody_SetAngvel (struct R2RigidBodyHandle handle, R2AngVector value, R2Bool wake_up)
 Set the rigid body world-space angular velocity (radians per second).
R2Status r2RigidBody_SetNextKinematicPosition (struct R2RigidBodyHandle handle, struct R2Pose value)
 Set the rigid body next kinematic world-space pose.
R2Status r2RigidBody_SetNextKinematicTranslation (struct R2RigidBodyHandle handle, struct R2Vector value)
 Set the rigid body next kinematic world-space translation.
R2Status r2RigidBody_SetGravityScale (struct R2RigidBodyHandle handle, R2Real value, R2Bool wake_up)
 Set the rigid body gravity multiplier.
R2Status r2RigidBody_SetLinearDamping (struct R2RigidBodyHandle handle, R2Real value)
 Set the rigid body linear damping coefficient.
R2Status r2RigidBody_SetAngularDamping (struct R2RigidBodyHandle handle, R2Real value)
 Set the rigid body angular damping coefficient.
R2Status r2RigidBody_SetEnabled (struct R2RigidBodyHandle handle, R2Bool value)
 Enable or disable the rigid body.
R2Status r2RigidBody_SetUserData (struct R2RigidBodyHandle handle, struct R2UserData value)
 Set the rigid body application-owned 128-bit user value.
R2Status r2RigidBody_ApplyImpulse (struct R2RigidBodyHandle handle, struct R2Vector value, R2Bool wake_up)
 Apply a world-space linear impulse.
R2Status r2RigidBody_ApplyImpulseAtPoint (struct R2RigidBodyHandle handle, struct R2Vector value, struct R2Vector point, R2Bool wake_up)
 Apply a world-space impulse at a world-space point.
R2Status r2RigidBody_AddForce (struct R2RigidBodyHandle handle, struct R2Vector value, R2Bool wake_up)
 Accumulate a world-space force; it persists until reset.
R2Status r2RigidBody_ResetForces (struct R2RigidBodyHandle handle, R2Bool wake_up)
 Clear accumulated user forces.
R2Status r2RigidBody_Sleep (struct R2RigidBodyHandle handle)
 Put the body to sleep.
size_t r2RigidBodyReadStates (const struct R2World *world, const struct R2RigidBodyHandle *handles, size_t handle_count, struct R2RigidBodyState *states, size_t capacity)
 Copies states in the same order as handles, without allocating temporary storage.
int8_t r2RigidBody_DominanceGroup (struct R2RigidBodyHandle handle)
 Return the rigid body signed dominance group.
size_t r2RigidBody_AdditionalSolverIterations (struct R2RigidBodyHandle handle)
 Return the rigid body additional solver iterations for connected bodies.
size_t r2RigidBody_AdditionalPgsIterations (struct R2RigidBodyHandle handle)
 Return the rigid body additional PGS iterations for connected bodies.
R2Bool r2RigidBody_IsFastRotationAllowed (struct R2RigidBodyHandle handle)
 Return whether the rigid body may exceed the angular-velocity limit of its CCD.
R2Status r2RigidBody_SetAllowFastRotation (struct R2RigidBodyHandle handle, R2Bool value)
 Allow or disallow the rigid body to exceed the angular-velocity limit of its CCD (e.g.
R2Status r2RigidBody_SetAdditionalMassProperties (struct R2RigidBodyHandle handle, struct R2MassProperties properties, R2Bool wake_up)
 Set the rigid body local mass properties added to collider contributions.
R2Status r2RigidBody_RecomputeMassPropertiesFromColliders (struct R2RigidBodyHandle handle)
 Recompute body mass and inertia from attached colliders and additional mass properties.
R2Status r2RigidBody_SetLockedAxes (struct R2RigidBodyHandle handle, uint8_t axes, R2Bool wake_up)
 Set the rigid body translation/rotation lock bitmask.
uint8_t r2RigidBody_LockedAxes (struct R2RigidBodyHandle handle)
 Return the rigid body translation/rotation lock bitmask.
struct R2Pose r2RigidBody_NextPosition (struct R2RigidBodyHandle handle)
 Return the rigid body next kinematic world-space pose.
struct R2Rotation r2RigidBody_Rotation (struct R2RigidBodyHandle handle)
 Return the rigid body world-space rotation.
struct R2Vector r2RigidBody_CenterOfMass (struct R2RigidBodyHandle handle)
 Return the rigid body world-space center of mass.
struct R2Vector r2RigidBody_LocalCenterOfMass (struct R2RigidBodyHandle handle)
 Return the rigid body body-local center of mass.
struct R2Vector r2RigidBody_UserForce (struct R2RigidBodyHandle handle)
 Return the rigid body accumulated user-applied world-space force.
R2AngVector r2RigidBody_UserTorque (struct R2RigidBodyHandle handle)
 Return the rigid body accumulated user-applied world-space torque.
uint32_t r2RigidBody_BodyType (struct R2RigidBodyHandle handle)
 Return the rigid body body type (R2_DYNAMIC, R2_FIXED, or a kinematic kind).
R2Real r2RigidBody_Mass (struct R2RigidBodyHandle handle)
 Return the rigid body mass.
R2Real r2RigidBody_GravityScale (struct R2RigidBodyHandle handle)
 Return the rigid body gravity multiplier.
R2Real r2RigidBody_LinearDamping (struct R2RigidBodyHandle handle)
 Return the rigid body linear damping coefficient.
R2Real r2RigidBody_AngularDamping (struct R2RigidBodyHandle handle)
 Return the rigid body angular damping coefficient.
R2Real r2RigidBody_KineticEnergy (struct R2RigidBodyHandle handle)
 Return the rigid body kinetic energy.
R2Real r2RigidBody_SoftCcdPrediction (struct R2RigidBodyHandle handle)
 Return the rigid body soft-CCD prediction distance.
R2Bool r2RigidBody_IsCcdEnabled (struct R2RigidBodyHandle handle)
 Return whether the rigid body is using continuous collision detection.
R2Bool r2RigidBody_IsDynamic (struct R2RigidBodyHandle handle)
 Return whether the rigid body is dynamic.
R2Bool r2RigidBody_IsFixed (struct R2RigidBodyHandle handle)
 Return whether the rigid body is fixed.
R2Bool r2RigidBody_IsKinematic (struct R2RigidBodyHandle handle)
 Return whether the rigid body is kinematic.
R2Bool r2RigidBody_IsMoving (struct R2RigidBodyHandle handle)
 Return whether the rigid body is moving.
R2Bool r2RigidBody_IsCcdActive (struct R2RigidBodyHandle handle)
 Return whether the rigid body is currently using CCD for its motion.
R2Status r2RigidBody_SetRotation (struct R2RigidBodyHandle handle, struct R2Rotation value, R2Bool wake_up)
 Set the rigid body world-space rotation.
R2Status r2RigidBody_SetBodyType (struct R2RigidBodyHandle handle, uint32_t value, R2Bool wake_up)
 Set the rigid body body type (R2_DYNAMIC, R2_FIXED, or a kinematic kind).
R2Status r2RigidBody_SetNextKinematicRotation (struct R2RigidBodyHandle handle, struct R2Rotation value)
 Set the rigid body next kinematic world-space rotation.
R2Status r2RigidBody_SetAdditionalMass (struct R2RigidBodyHandle handle, R2Real value, R2Bool wake_up)
 Set the rigid body mass added to collider contributions.
R2Status r2RigidBody_SetSoftCcdPrediction (struct R2RigidBodyHandle handle, R2Real value)
 Set the rigid body soft-CCD prediction distance.
R2Status r2RigidBody_SetCcdEnabled (struct R2RigidBodyHandle handle, R2Bool value)
 Enable or disable using continuous collision detection for the rigid body.
R2Status r2RigidBody_SetTranslationsLocked (struct R2RigidBodyHandle handle, R2Bool value, R2Bool wake_up)
 Enable or disable locking translation for the rigid body.
R2Status r2RigidBody_SetRotationsLocked (struct R2RigidBodyHandle handle, R2Bool value, R2Bool wake_up)
 Enable or disable locking rotation for the rigid body.
R2Status r2RigidBody_SetDominanceGroup (struct R2RigidBodyHandle handle, int8_t value)
 Set the rigid body signed dominance group.
R2Status r2RigidBody_SetAdditionalSolverIterations (struct R2RigidBodyHandle handle, size_t value)
 Set the rigid body additional solver iterations for connected bodies.
R2Status r2RigidBody_SetAdditionalPgsIterations (struct R2RigidBodyHandle handle, size_t value)
 Set the rigid body additional PGS iterations.
R2Status r2RigidBody_AddTorque (struct R2RigidBodyHandle handle, R2AngVector value, R2Bool wake_up)
 Accumulate a world-space torque; it persists until reset.
R2Status r2RigidBody_ApplyTorqueImpulse (struct R2RigidBodyHandle handle, R2AngVector value, R2Bool wake_up)
 Apply a world-space angular impulse.
R2Status r2RigidBody_AddForceAtPoint (struct R2RigidBodyHandle handle, struct R2Vector value, struct R2Vector point, R2Bool wake_up)
 Accumulate a world-space force applied at a world-space point.
R2Status r2RigidBody_ResetTorques (struct R2RigidBodyHandle handle, R2Bool wake_up)
 Clear accumulated user torques.
struct R2Vector r2RigidBody_VelocityAtPoint (struct R2RigidBodyHandle handle, struct R2Vector point)
 Return world-space velocity at a world-space point, including angular motion.
size_t r2RigidBody_Colliders (struct R2RigidBodyHandle handle, struct R2ColliderHandle *buffer, size_t capacity)
 Copy attached collider handles.
R2Status r2RigidBody_ValidateHandle (struct R2RigidBodyHandle handle)
 Validate the index and generation in the live owning world.

Detailed Description

Descriptions and live, world-bound handles.

Accessors return copies. Handle operations report INVALID_HANDLE for a removed/stale entity in a live world.

Macro Definition Documentation

◆ R2_DYNAMIC

#define R2_DYNAMIC   0

Dynamic body affected by forces and contacts.

◆ R2_FIXED

#define R2_FIXED   1

Immovable body.

◆ R2_KINEMATIC_POSITION_BASED

#define R2_KINEMATIC_POSITION_BASED   2

Kinematic body controlled by its next pose.

◆ R2_KINEMATIC_VELOCITY_BASED

#define R2_KINEMATIC_VELOCITY_BASED   3

Kinematic body controlled by its velocity.

◆ R2_LOCK_ROTATION_X

#define R2_LOCK_ROTATION_X   8

Rigid-body lock bit: rotation x.

◆ R2_LOCK_ROTATION_Y

#define R2_LOCK_ROTATION_Y   16

Rigid-body lock bit: rotation y.

◆ R2_LOCK_ROTATION_Z

#define R2_LOCK_ROTATION_Z   32

Rigid-body lock bit: rotation z.

◆ R2_LOCK_TRANSLATION_X

#define R2_LOCK_TRANSLATION_X   1

Rigid-body lock bit: translation x.

◆ R2_LOCK_TRANSLATION_Y

#define R2_LOCK_TRANSLATION_Y   2

Rigid-body lock bit: translation y.

◆ R2_LOCK_TRANSLATION_Z

#define R2_LOCK_TRANSLATION_Z   4

Rigid-body lock bit: translation z.

Typedef Documentation

◆ R2RigidBodyDesc

typedef struct R2RigidBodyDesc R2RigidBodyDesc

Stack-allocated rigid-body construction data.

Initialize with r2DynamicRigidBodyDesc, r2FixedRigidBodyDesc, or a kinematic description constructor. Copying this value is safe; it owns no resources and must never be freed by Rapier.

◆ R2RigidBodyHandle

typedef struct R2RigidBodyHandle R2RigidBodyHandle

Copyable non-owning handle: world pointer plus entity index and generation.

The world must remain alive throughout every use. Copying does not retain it. UINT32_MAX/UINT32_MAX with a NULL world is invalid.

◆ R2RigidBodyState

typedef struct R2RigidBodyState R2RigidBodyState

A copied state snapshot, with no pointers or ownership obligations.

Function Documentation

◆ r2DynamicRigidBodyDesc()

struct R2RigidBodyDesc r2DynamicRigidBodyDesc ( void )

Return a dynamic rigid-body description with native defaults; no allocation.

◆ r2FixedRigidBodyDesc()

struct R2RigidBodyDesc r2FixedRigidBodyDesc ( void )

Return a fixed rigid-body description with native defaults; no allocation.

◆ r2InsertRigidBody()

struct R2RigidBodyHandle r2InsertRigidBody ( struct R2World * world,
const struct R2RigidBodyDesc * desc )

Create a body from the description and return its world-bound handle.

The world owns the body.

◆ r2KinematicPositionBasedRigidBodyDesc()

struct R2RigidBodyDesc r2KinematicPositionBasedRigidBodyDesc ( void )

Return a kinematic position based rigid-body description with native defaults; no allocation.

◆ r2KinematicVelocityBasedRigidBodyDesc()

struct R2RigidBodyDesc r2KinematicVelocityBasedRigidBodyDesc ( void )

Return a kinematic velocity based rigid-body description with native defaults; no allocation.

◆ r2RemoveRigidBody()

R2Status r2RemoveRigidBody ( struct R2RigidBodyHandle handle,
R2Bool remove_attached_colliders )

Remove a body and its joints, optionally keeping colliders as standalone objects.

A removed or stale handle fails with R2_INVALID_HANDLE, like the other Remove functions. Removing a soft-body cluster proxy removes its cluster (see r2SoftBody_RemoveCluster). The root body of a soft body is rejected: remove the soft body with r2RemoveSoftBody.

◆ r2RigidBody_AddForce()

R2Status r2RigidBody_AddForce ( struct R2RigidBodyHandle handle,
struct R2Vector value,
R2Bool wake_up )

Accumulate a world-space force; it persists until reset.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_AddForceAtPoint()

R2Status r2RigidBody_AddForceAtPoint ( struct R2RigidBodyHandle handle,
struct R2Vector value,
struct R2Vector point,
R2Bool wake_up )

Accumulate a world-space force applied at a world-space point.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_AdditionalPgsIterations()

size_t r2RigidBody_AdditionalPgsIterations ( struct R2RigidBodyHandle handle)

Return the rigid body additional PGS iterations for connected bodies.

◆ r2RigidBody_AdditionalSolverIterations()

size_t r2RigidBody_AdditionalSolverIterations ( struct R2RigidBodyHandle handle)

Return the rigid body additional solver iterations for connected bodies.

◆ r2RigidBody_AddTorque()

R2Status r2RigidBody_AddTorque ( struct R2RigidBodyHandle handle,
R2AngVector value,
R2Bool wake_up )

Accumulate a world-space torque; it persists until reset.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_AngularDamping()

R2Real r2RigidBody_AngularDamping ( struct R2RigidBodyHandle handle)

Return the rigid body angular damping coefficient.

◆ r2RigidBody_Angvel()

R2AngVector r2RigidBody_Angvel ( struct R2RigidBodyHandle handle)

Return the rigid body world-space angular velocity (radians per second).

◆ r2RigidBody_ApplyImpulse()

R2Status r2RigidBody_ApplyImpulse ( struct R2RigidBodyHandle handle,
struct R2Vector value,
R2Bool wake_up )

Apply a world-space linear impulse.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_ApplyImpulseAtPoint()

R2Status r2RigidBody_ApplyImpulseAtPoint ( struct R2RigidBodyHandle handle,
struct R2Vector value,
struct R2Vector point,
R2Bool wake_up )

Apply a world-space impulse at a world-space point.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_ApplyTorqueImpulse()

R2Status r2RigidBody_ApplyTorqueImpulse ( struct R2RigidBodyHandle handle,
R2AngVector value,
R2Bool wake_up )

Apply a world-space angular impulse.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_BodyType()

uint32_t r2RigidBody_BodyType ( struct R2RigidBodyHandle handle)

Return the rigid body body type (R2_DYNAMIC, R2_FIXED, or a kinematic kind).

◆ r2RigidBody_CenterOfMass()

struct R2Vector r2RigidBody_CenterOfMass ( struct R2RigidBodyHandle handle)

Return the rigid body world-space center of mass.

◆ r2RigidBody_Colliders()

size_t r2RigidBody_Colliders ( struct R2RigidBodyHandle handle,
struct R2ColliderHandle * buffer,
size_t capacity )

Copy attached collider handles.

See also
Arrays and output buffers

◆ r2RigidBody_Contains()

R2Bool r2RigidBody_Contains ( struct R2RigidBodyHandle handle)

Test whether the live world contains this rigid body handle.

A removed/stale handle returns false.

◆ r2RigidBody_DominanceGroup()

int8_t r2RigidBody_DominanceGroup ( struct R2RigidBodyHandle handle)

Return the rigid body signed dominance group.

◆ r2RigidBody_GravityScale()

R2Real r2RigidBody_GravityScale ( struct R2RigidBodyHandle handle)

Return the rigid body gravity multiplier.

◆ r2RigidBody_IsCcdActive()

R2Bool r2RigidBody_IsCcdActive ( struct R2RigidBodyHandle handle)

Return whether the rigid body is currently using CCD for its motion.

◆ r2RigidBody_IsCcdEnabled()

R2Bool r2RigidBody_IsCcdEnabled ( struct R2RigidBodyHandle handle)

Return whether the rigid body is using continuous collision detection.

◆ r2RigidBody_IsDynamic()

R2Bool r2RigidBody_IsDynamic ( struct R2RigidBodyHandle handle)

Return whether the rigid body is dynamic.

◆ r2RigidBody_IsEnabled()

R2Bool r2RigidBody_IsEnabled ( struct R2RigidBodyHandle handle)

Return whether the rigid body is enabled.

◆ r2RigidBody_IsFastRotationAllowed()

R2Bool r2RigidBody_IsFastRotationAllowed ( struct R2RigidBodyHandle handle)

Return whether the rigid body may exceed the angular-velocity limit of its CCD.

◆ r2RigidBody_IsFixed()

R2Bool r2RigidBody_IsFixed ( struct R2RigidBodyHandle handle)

Return whether the rigid body is fixed.

◆ r2RigidBody_IsKinematic()

R2Bool r2RigidBody_IsKinematic ( struct R2RigidBodyHandle handle)

Return whether the rigid body is kinematic.

◆ r2RigidBody_IsMoving()

R2Bool r2RigidBody_IsMoving ( struct R2RigidBodyHandle handle)

Return whether the rigid body is moving.

◆ r2RigidBody_IsSleeping()

R2Bool r2RigidBody_IsSleeping ( struct R2RigidBodyHandle handle)

Return whether the rigid body is sleeping.

◆ r2RigidBody_KineticEnergy()

R2Real r2RigidBody_KineticEnergy ( struct R2RigidBodyHandle handle)

Return the rigid body kinetic energy.

◆ r2RigidBody_LinearDamping()

R2Real r2RigidBody_LinearDamping ( struct R2RigidBodyHandle handle)

Return the rigid body linear damping coefficient.

◆ r2RigidBody_Linvel()

struct R2Vector r2RigidBody_Linvel ( struct R2RigidBodyHandle handle)

Return the rigid body world-space linear velocity.

◆ r2RigidBody_LocalCenterOfMass()

struct R2Vector r2RigidBody_LocalCenterOfMass ( struct R2RigidBodyHandle handle)

Return the rigid body body-local center of mass.

◆ r2RigidBody_LockedAxes()

uint8_t r2RigidBody_LockedAxes ( struct R2RigidBodyHandle handle)

Return the rigid body translation/rotation lock bitmask.

◆ r2RigidBody_Mass()

R2Real r2RigidBody_Mass ( struct R2RigidBodyHandle handle)

Return the rigid body mass.

◆ r2RigidBody_NextPosition()

struct R2Pose r2RigidBody_NextPosition ( struct R2RigidBodyHandle handle)

Return the rigid body next kinematic world-space pose.

◆ r2RigidBody_Position()

struct R2Pose r2RigidBody_Position ( struct R2RigidBodyHandle handle)

Return the rigid body world-space pose.

◆ r2RigidBody_RecomputeMassPropertiesFromColliders()

R2Status r2RigidBody_RecomputeMassPropertiesFromColliders ( struct R2RigidBodyHandle handle)

Recompute body mass and inertia from attached colliders and additional mass properties.

◆ r2RigidBody_ResetForces()

R2Status r2RigidBody_ResetForces ( struct R2RigidBodyHandle handle,
R2Bool wake_up )

Clear accumulated user forces.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_ResetTorques()

R2Status r2RigidBody_ResetTorques ( struct R2RigidBodyHandle handle,
R2Bool wake_up )

Clear accumulated user torques.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_Rotation()

struct R2Rotation r2RigidBody_Rotation ( struct R2RigidBodyHandle handle)

Return the rigid body world-space rotation.

◆ r2RigidBody_SetAdditionalMass()

R2Status r2RigidBody_SetAdditionalMass ( struct R2RigidBodyHandle handle,
R2Real value,
R2Bool wake_up )

Set the rigid body mass added to collider contributions.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetAdditionalMassProperties()

R2Status r2RigidBody_SetAdditionalMassProperties ( struct R2RigidBodyHandle handle,
struct R2MassProperties properties,
R2Bool wake_up )

Set the rigid body local mass properties added to collider contributions.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetAdditionalPgsIterations()

R2Status r2RigidBody_SetAdditionalPgsIterations ( struct R2RigidBodyHandle handle,
size_t value )

Set the rigid body additional PGS iterations.

◆ r2RigidBody_SetAdditionalSolverIterations()

R2Status r2RigidBody_SetAdditionalSolverIterations ( struct R2RigidBodyHandle handle,
size_t value )

Set the rigid body additional solver iterations for connected bodies.

◆ r2RigidBody_SetAllowFastRotation()

R2Status r2RigidBody_SetAllowFastRotation ( struct R2RigidBodyHandle handle,
R2Bool value )

Allow or disallow the rigid body to exceed the angular-velocity limit of its CCD (e.g.

for wheels).

◆ r2RigidBody_SetAngularDamping()

R2Status r2RigidBody_SetAngularDamping ( struct R2RigidBodyHandle handle,
R2Real value )

Set the rigid body angular damping coefficient.

◆ r2RigidBody_SetAngvel()

R2Status r2RigidBody_SetAngvel ( struct R2RigidBodyHandle handle,
R2AngVector value,
R2Bool wake_up )

Set the rigid body world-space angular velocity (radians per second).

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetBodyType()

R2Status r2RigidBody_SetBodyType ( struct R2RigidBodyHandle handle,
uint32_t value,
R2Bool wake_up )

Set the rigid body body type (R2_DYNAMIC, R2_FIXED, or a kinematic kind).

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetCcdEnabled()

R2Status r2RigidBody_SetCcdEnabled ( struct R2RigidBodyHandle handle,
R2Bool value )

Enable or disable using continuous collision detection for the rigid body.

◆ r2RigidBody_SetDominanceGroup()

R2Status r2RigidBody_SetDominanceGroup ( struct R2RigidBodyHandle handle,
int8_t value )

Set the rigid body signed dominance group.

◆ r2RigidBody_SetEnabled()

R2Status r2RigidBody_SetEnabled ( struct R2RigidBodyHandle handle,
R2Bool value )

Enable or disable the rigid body.

◆ r2RigidBody_SetGravityScale()

R2Status r2RigidBody_SetGravityScale ( struct R2RigidBodyHandle handle,
R2Real value,
R2Bool wake_up )

Set the rigid body gravity multiplier.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetLinearDamping()

R2Status r2RigidBody_SetLinearDamping ( struct R2RigidBodyHandle handle,
R2Real value )

Set the rigid body linear damping coefficient.

◆ r2RigidBody_SetLinvel()

R2Status r2RigidBody_SetLinvel ( struct R2RigidBodyHandle handle,
struct R2Vector value,
R2Bool wake_up )

Set the rigid body world-space linear velocity.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetLockedAxes()

R2Status r2RigidBody_SetLockedAxes ( struct R2RigidBodyHandle handle,
uint8_t axes,
R2Bool wake_up )

Set the rigid body translation/rotation lock bitmask.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetNextKinematicPosition()

R2Status r2RigidBody_SetNextKinematicPosition ( struct R2RigidBodyHandle handle,
struct R2Pose value )

Set the rigid body next kinematic world-space pose.

◆ r2RigidBody_SetNextKinematicRotation()

R2Status r2RigidBody_SetNextKinematicRotation ( struct R2RigidBodyHandle handle,
struct R2Rotation value )

Set the rigid body next kinematic world-space rotation.

◆ r2RigidBody_SetNextKinematicTranslation()

R2Status r2RigidBody_SetNextKinematicTranslation ( struct R2RigidBodyHandle handle,
struct R2Vector value )

Set the rigid body next kinematic world-space translation.

◆ r2RigidBody_SetPosition()

R2Status r2RigidBody_SetPosition ( struct R2RigidBodyHandle handle,
struct R2Pose value,
R2Bool wake_up )

Set the rigid body world-space pose.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetRotation()

R2Status r2RigidBody_SetRotation ( struct R2RigidBodyHandle handle,
struct R2Rotation value,
R2Bool wake_up )

Set the rigid body world-space rotation.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetRotationsLocked()

R2Status r2RigidBody_SetRotationsLocked ( struct R2RigidBodyHandle handle,
R2Bool value,
R2Bool wake_up )

Enable or disable locking rotation for the rigid body.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetSoftCcdPrediction()

R2Status r2RigidBody_SetSoftCcdPrediction ( struct R2RigidBodyHandle handle,
R2Real value )

Set the rigid body soft-CCD prediction distance.

◆ r2RigidBody_SetTranslation()

R2Status r2RigidBody_SetTranslation ( struct R2RigidBodyHandle handle,
struct R2Vector value,
R2Bool wake_up )

Set the rigid body world-space translation.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetTranslationsLocked()

R2Status r2RigidBody_SetTranslationsLocked ( struct R2RigidBodyHandle handle,
R2Bool value,
R2Bool wake_up )

Enable or disable locking translation for the rigid body.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2RigidBody_SetUserData()

R2Status r2RigidBody_SetUserData ( struct R2RigidBodyHandle handle,
struct R2UserData value )

Set the rigid body application-owned 128-bit user value.

◆ r2RigidBody_Sleep()

R2Status r2RigidBody_Sleep ( struct R2RigidBodyHandle handle)

Put the body to sleep.

◆ r2RigidBody_SoftCcdPrediction()

R2Real r2RigidBody_SoftCcdPrediction ( struct R2RigidBodyHandle handle)

Return the rigid body soft-CCD prediction distance.

◆ r2RigidBody_Translation()

struct R2Vector r2RigidBody_Translation ( struct R2RigidBodyHandle handle)

Return the rigid body world-space translation.

◆ r2RigidBody_UserData()

struct R2UserData r2RigidBody_UserData ( struct R2RigidBodyHandle handle)

Return the rigid body application-owned 128-bit user value.

◆ r2RigidBody_UserForce()

struct R2Vector r2RigidBody_UserForce ( struct R2RigidBodyHandle handle)

Return the rigid body accumulated user-applied world-space force.

◆ r2RigidBody_UserTorque()

R2AngVector r2RigidBody_UserTorque ( struct R2RigidBodyHandle handle)

Return the rigid body accumulated user-applied world-space torque.

◆ r2RigidBody_ValidateHandle()

R2Status r2RigidBody_ValidateHandle ( struct R2RigidBodyHandle handle)

Validate the index and generation in the live owning world.

Cannot detect a world pointer that has already been freed.

◆ r2RigidBody_VelocityAtPoint()

struct R2Vector r2RigidBody_VelocityAtPoint ( struct R2RigidBodyHandle handle,
struct R2Vector point )

Return world-space velocity at a world-space point, including angular motion.

◆ r2RigidBody_WakeUp()

R2Status r2RigidBody_WakeUp ( struct R2RigidBodyHandle handle,
R2Bool strong )

Wake a body by handle, including a soft-body cluster proxy.

◆ r2RigidBodyCount()

size_t r2RigidBodyCount ( const struct R2World * world)

Return the number of rigid body objects in the world.

◆ r2RigidBodyHandles()

size_t r2RigidBodyHandles ( const struct R2World * world,
struct R2RigidBodyHandle * buffer,
size_t capacity )

Copy entity handles.

See also
Arrays and output buffers

◆ r2RigidBodyPropagateModifiedBodyPositionsToColliders()

R2Status r2RigidBodyPropagateModifiedBodyPositionsToColliders ( struct R2World * world)

Propagate all modified body poses to attached colliders.

Run collision detection or step before querying the broad phase.

◆ r2RigidBodyReadStates()

size_t r2RigidBodyReadStates ( const struct R2World * world,
const struct R2RigidBodyHandle * handles,
size_t handle_count,
struct R2RigidBodyState * states,
size_t capacity )

Copies states in the same order as handles, without allocating temporary storage.

All handles are validated before writing. On INVALID_HANDLE outputs are unchanged. NULL/0 is a size query. BUFFER_TOO_SMALL returns the required count and leaves states untouched.