Rapier C — 2D / f64 0.36.0+c.0
Loading...
Searching...
No Matches
Callback read access

Read* functions resolve handles through the callback context. More...

Data Structures

struct  R2PhysicsHooks
 Callbacks must not unwind or retain arguments. More...

Typedefs

typedef struct R2ContactModificationContext R2ContactModificationContext
 Borrowed native contact context.
typedef struct R2ReadContext R2ReadContext
 Callback-scoped read access to bodies and colliders.
typedef int32_t(*) R2PairFilter(void *user_data, const struct R2ReadContext *read, struct R2ColliderHandle collider1, struct R2ColliderHandle collider2, struct R2RigidBodyHandle body1, struct R2RigidBodyHandle body2)
 Pair callback: -1 rejects a contact pair; 0 detects contacts without impulses; 1 computes impulses.
typedef void(*) R2ModifyContacts(void *user_data, const struct R2ReadContext *read, struct R2ColliderHandle collider1, struct R2ColliderHandle collider2, struct R2ContactModification *contact)
 Modify aggregate contact properties for one pair; contact is mutable only during this callback.
typedef void(*) R2ModifyContactContext(void *user_data, const struct R2ReadContext *read, struct R2ColliderHandle collider1, struct R2ColliderHandle collider2, struct R2ContactModificationContext *context)
 Modify individual solver contacts through a borrowed context, valid only during the callback.
typedef struct R2PhysicsHooks R2PhysicsHooks
 Callbacks must not unwind or retain arguments.

Functions

R2Status r2ContactModificationContext_UpdateAsOnewayPlatform (struct R2ContactModificationContext *context, struct R2Vector allowed_local_n1, R2Real allowed_angle)
 Applies Rapier's persistent one-way platform logic to the borrowed manifold.
R2Status r2ContactModificationContext_SetTangentVelocity (struct R2ContactModificationContext *context, struct R2Vector velocity)
 Sets the tangent velocity of every rigid solver contact in this manifold.
struct R2SoftBodyHandle r2ReadCollider_SoftBody (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the soft body owning this deformable collider, or an invalid handle for any other collider.
struct R2VelocityCorrection r2ReadPidController_RigidBodyCorrection (const struct R2ReadContext *context, struct R2PidController *controller, R2Real dt, struct R2RigidBodyHandle body, struct R2Pose target_pose, struct R2Vector target_linvel, R2AngVector target_angvel)
 Compute a velocity correction from callback-visible body state, updating the PID controller history.
struct R2VelocityCorrection r2ReadPdController_RigidBodyCorrection (const struct R2ReadContext *context, const struct R2PdController *controller, struct R2RigidBodyHandle body, struct R2Pose target_pose, struct R2Vector target_linvel, R2AngVector target_angvel)
 Compute a PD velocity correction from callback-visible body state.
size_t r2ReadRigidBodyCount (const struct R2ReadContext *context)
 Return the number of rigid body objects in the world.
size_t r2ReadRigidBodyHandles (const struct R2ReadContext *context, struct R2RigidBodyHandle *buffer, size_t capacity)
 Copy entity handles.
R2Bool r2ReadRigidBody_Contains (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Test whether the live world contains this rigid body handle.
size_t r2ReadColliderCount (const struct R2ReadContext *context)
 Return the number of collider objects in the world.
size_t r2ReadColliderHandles (const struct R2ReadContext *context, struct R2ColliderHandle *buffer, size_t capacity)
 Copy entity handles.
R2Bool r2ReadCollider_Contains (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Test whether the live world contains this collider handle.
size_t r2ReadCollider_ShapeIdentity (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return a process-local geometry identity for caching, not a serializable ID.
struct R2MassProperties r2ReadCollider_MassProperties (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider local mass properties.
uint8_t r2ReadRigidBody_LockedAxes (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body translation/rotation lock bitmask.
R2Bool r2ReadCollider_IsVoxels (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return whether the collider is a voxel shape.
struct R2VoxelQuery r2ReadCollider_VoxelAtFlatId (const struct R2ReadContext *context, struct R2ColliderHandle handle, uint32_t id)
 Return voxel information at a flat index; found = 0 if absent.
struct R2Pose r2ReadRigidBody_NextPosition (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body next kinematic world-space pose.
struct R2Rotation r2ReadRigidBody_Rotation (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body world-space rotation.
struct R2Vector r2ReadRigidBody_CenterOfMass (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body world-space center of mass.
struct R2Vector r2ReadRigidBody_LocalCenterOfMass (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body body-local center of mass.
struct R2Vector r2ReadRigidBody_UserForce (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body accumulated user-applied world-space force.
R2AngVector r2ReadRigidBody_UserTorque (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body accumulated user-applied world-space torque.
uint32_t r2ReadRigidBody_BodyType (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body body type (R2_DYNAMIC, R2_FIXED, or a kinematic kind).
R2Real r2ReadRigidBody_Mass (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body mass.
R2Real r2ReadRigidBody_GravityScale (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body gravity multiplier.
R2Real r2ReadRigidBody_LinearDamping (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body linear damping coefficient.
R2Real r2ReadRigidBody_AngularDamping (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body angular damping coefficient.
R2Real r2ReadRigidBody_KineticEnergy (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body kinetic energy.
R2Real r2ReadRigidBody_SoftCcdPrediction (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body soft-CCD prediction distance.
R2Bool r2ReadRigidBody_IsCcdEnabled (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return whether the rigid body is using continuous collision detection.
R2Bool r2ReadRigidBody_IsDynamic (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return whether the rigid body is dynamic.
struct R2SoftBodyHandle r2ReadRigidBody_SoftBody (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the associated soft-body handle, or an invalid handle if this is not a soft proxy.
R2Bool r2ReadRigidBody_IsSoftFrame (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return whether the rigid body is a soft-body proxy.
R2Bool r2ReadRigidBody_IsFixed (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return whether the rigid body is fixed.
R2Bool r2ReadRigidBody_IsKinematic (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return whether the rigid body is kinematic.
R2Bool r2ReadRigidBody_IsMoving (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return whether the rigid body is moving.
R2Bool r2ReadRigidBody_IsCcdActive (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return whether the rigid body is currently using CCD for its motion.
struct R2Vector r2ReadRigidBody_VelocityAtPoint (const struct R2ReadContext *context, struct R2RigidBodyHandle handle, struct R2Vector point)
 Return world-space velocity at a world-space point, including angular motion.
size_t r2ReadRigidBody_Colliders (const struct R2ReadContext *context, struct R2RigidBodyHandle handle, struct R2ColliderHandle *buffer, size_t capacity)
 Copy attached collider handles.
struct R2Rotation r2ReadCollider_Rotation (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider world-space rotation.
struct R2InteractionGroups r2ReadCollider_CollisionGroups (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider collision filtering groups.
struct R2InteractionGroups r2ReadCollider_SolverGroups (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider contact-force filtering groups.
struct R2UserData r2ReadCollider_UserData (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider application-owned 128-bit user value.
uint32_t r2ReadCollider_ActiveEvents (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider event-generation bitmask (R2_COLLISION_EVENTS and R2_CONTACT_FORCE_EVENTS).
R2Real r2ReadCollider_Mass (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider mass.
R2Real r2ReadCollider_Density (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider mass per unit volume.
R2Real r2ReadCollider_Volume (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider current volume.
R2Real r2ReadCollider_ContactSkin (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider extra separation skin around the shape.
R2Real r2ReadCollider_ContactForceEventThreshold (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider force threshold for contact-force events.
R2Bool r2ReadCollider_IsEnabled (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return whether the collider is enabled.
struct R2Aabb r2ReadCollider_ComputeAabb (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the current world-space axis-aligned bounds.
R2SharedShape * r2ReadCollider_CloneShape (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return an owned wrapper sharing the collider geometry.
R2Status r2ReadRigidBody_ValidateHandle (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Validate the index and generation in the live owning world.
R2Status r2ReadCollider_ValidateHandle (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Validate the index and generation in the live owning world.
struct R2Pose r2ReadRigidBody_Position (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body world-space pose.
struct R2Vector r2ReadRigidBody_Translation (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body world-space translation.
struct R2Vector r2ReadRigidBody_Linvel (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body world-space linear velocity.
R2AngVector r2ReadRigidBody_Angvel (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body world-space angular velocity (radians per second).
R2Bool r2ReadRigidBody_IsSleeping (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return whether the rigid body is sleeping.
R2Bool r2ReadRigidBody_IsEnabled (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return whether the rigid body is enabled.
struct R2UserData r2ReadRigidBody_UserData (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body application-owned 128-bit user value.
struct R2Pose r2ReadCollider_Position (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider world-space pose.
struct R2Vector r2ReadCollider_Translation (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider world-space translation.
R2Real r2ReadCollider_Friction (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider friction coefficient.
R2Real r2ReadCollider_Restitution (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider restitution coefficient.
R2Bool r2ReadCollider_IsSensor (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return whether the collider is a sensor (detects overlaps without contact forces).
struct R2RigidBodyHandle r2ReadCollider_Parent (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Read the parent body handle during a callback; a standalone collider returns an invalid handle with OK status.
size_t r2ReadRigidBodyReadStates (const struct R2ReadContext *context, const struct R2RigidBodyHandle *handles, size_t handle_count, struct R2RigidBodyState *states, size_t capacity)
 Copy callback-visible body states in the supplied handle order.
uint16_t r2ReadCollider_ActiveCollisionTypes (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider body-type collision activation bitmask (R2_COLLISION_TYPES_* bits).
uint32_t r2ReadCollider_ActiveHooks (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider physics-hook activation bitmask.
uint32_t r2ReadCollider_FrictionCombineRule (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider friction combination rule (R2_COMBINE_*).
uint32_t r2ReadCollider_RestitutionCombineRule (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider restitution combination rule (R2_COMBINE_*).
struct R2Pose r2ReadCollider_PositionWrtParent (const struct R2ReadContext *context, struct R2ColliderHandle handle)
 Return the collider pose relative to its parent rigid body, or its world-space pose if it has no parent.
int8_t r2ReadRigidBody_DominanceGroup (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body signed dominance group.
size_t r2ReadRigidBody_AdditionalSolverIterations (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body additional solver iterations for connected bodies.
size_t r2ReadRigidBody_AdditionalPgsIterations (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return the rigid body additional PGS iterations for connected bodies.
R2Bool r2ReadRigidBody_IsFastRotationAllowed (const struct R2ReadContext *context, struct R2RigidBodyHandle handle)
 Return whether the rigid body may exceed the angular-velocity limit of its CCD.
R2Bool r2ContactModificationContext_IsSoft (const struct R2ContactModificationContext *context)
 Return whether the context holds the contact candidates of two soft surfaces rather than a manifold.
size_t r2ContactModificationContext_SolverContactCount (const struct R2ContactModificationContext *context)
 Return the number of solver contacts of the manifold; zero for a soft context.
struct R2SolverContact r2ContactModificationContext_SolverContact (const struct R2ContactModificationContext *context, size_t index)
 Return a solver contact of the manifold.
R2Status r2ContactModificationContext_SetSolverContact (struct R2ContactModificationContext *context, size_t index, const struct R2SolverContact *contact)
 Replace the points, distance and tangent velocity of a solver contact of the manifold.
R2Status r2ContactModificationContext_RemoveSolverContact (struct R2ContactModificationContext *context, size_t index)
 Remove a solver contact of the manifold.

Detailed Description

Read* functions resolve handles through the callback context.

This context is borrowed for that callback only and cannot mutate the world.

Typedef Documentation

◆ R2ContactModificationContext

Borrowed native contact context.

Valid only during its callback; never retain or free it.

◆ R2ModifyContactContext

typedef void(*) R2ModifyContactContext(void *user_data, const struct R2ReadContext *read, struct R2ColliderHandle collider1, struct R2ColliderHandle collider2, struct R2ContactModificationContext *context)

Modify individual solver contacts through a borrowed context, valid only during the callback.

◆ R2ModifyContacts

typedef void(*) R2ModifyContacts(void *user_data, const struct R2ReadContext *read, struct R2ColliderHandle collider1, struct R2ColliderHandle collider2, struct R2ContactModification *contact)

Modify aggregate contact properties for one pair; contact is mutable only during this callback.

◆ R2PairFilter

typedef int32_t(*) R2PairFilter(void *user_data, const struct R2ReadContext *read, struct R2ColliderHandle collider1, struct R2ColliderHandle collider2, struct R2RigidBodyHandle body1, struct R2RigidBodyHandle body2)

Pair callback: -1 rejects a contact pair; 0 detects contacts without impulses; 1 computes impulses.

For sensor intersections only, zero rejects and any positive value accepts.

◆ R2PhysicsHooks

typedef struct R2PhysicsHooks R2PhysicsHooks

Callbacks must not unwind or retain arguments.

Use their ReadContext to inspect bodies and colliders; ordinary access to the stepping world returns WORLD_BUSY. Mutations must be performed after stepping. With parallel builds callbacks and their user_data must be safe for concurrent invocation. NULL callbacks use defaults.

◆ R2ReadContext

typedef struct R2ReadContext R2ReadContext

Callback-scoped read access to bodies and colliders.

Never retain or free it. Only the Read* functions accept this context; it cannot mutate the world.

Function Documentation

◆ r2ContactModificationContext_IsSoft()

R2Bool r2ContactModificationContext_IsSoft ( const struct R2ContactModificationContext * context)

Return whether the context holds the contact candidates of two soft surfaces rather than a manifold.

Solver-contact accessors see no contacts in a soft context.

◆ r2ContactModificationContext_RemoveSolverContact()

R2Status r2ContactModificationContext_RemoveSolverContact ( struct R2ContactModificationContext * context,
size_t index )

Remove a solver contact of the manifold.

The last solver contact takes its index.

◆ r2ContactModificationContext_SetSolverContact()

R2Status r2ContactModificationContext_SetSolverContact ( struct R2ContactModificationContext * context,
size_t index,
const struct R2SolverContact * contact )

Replace the points, distance and tangent velocity of a solver contact of the manifold.

Points are world-space; a distance differing from their gap along the normal shifts the contact.

◆ r2ContactModificationContext_SetTangentVelocity()

R2Status r2ContactModificationContext_SetTangentVelocity ( struct R2ContactModificationContext * context,
struct R2Vector velocity )

Sets the tangent velocity of every rigid solver contact in this manifold.

◆ r2ContactModificationContext_SolverContact()

struct R2SolverContact r2ContactModificationContext_SolverContact ( const struct R2ContactModificationContext * context,
size_t index )

Return a solver contact of the manifold.

Inside the hook, points are world-space.

◆ r2ContactModificationContext_SolverContactCount()

size_t r2ContactModificationContext_SolverContactCount ( const struct R2ContactModificationContext * context)

Return the number of solver contacts of the manifold; zero for a soft context.

◆ r2ContactModificationContext_UpdateAsOnewayPlatform()

R2Status r2ContactModificationContext_UpdateAsOnewayPlatform ( struct R2ContactModificationContext * context,
struct R2Vector allowed_local_n1,
R2Real allowed_angle )

Applies Rapier's persistent one-way platform logic to the borrowed manifold.

◆ r2ReadCollider_ActiveCollisionTypes()

uint16_t r2ReadCollider_ActiveCollisionTypes ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider body-type collision activation bitmask (R2_COLLISION_TYPES_* bits).

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_ActiveEvents()

uint32_t r2ReadCollider_ActiveEvents ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider event-generation bitmask (R2_COLLISION_EVENTS and R2_CONTACT_FORCE_EVENTS).

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_ActiveHooks()

uint32_t r2ReadCollider_ActiveHooks ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider physics-hook activation bitmask.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_CloneShape()

R2SharedShape * r2ReadCollider_CloneShape ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return an owned wrapper sharing the collider geometry.

Release with r2FreeSharedShape. Uses only the callback-scoped read context; never retain the context. Returns an owned shape wrapper sharing the geometry. Release it with FreeSharedShape.

◆ r2ReadCollider_CollisionGroups()

struct R2InteractionGroups r2ReadCollider_CollisionGroups ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider collision filtering groups.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_ComputeAabb()

struct R2Aabb r2ReadCollider_ComputeAabb ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the current world-space axis-aligned bounds.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_ContactForceEventThreshold()

R2Real r2ReadCollider_ContactForceEventThreshold ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider force threshold for contact-force events.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_ContactSkin()

R2Real r2ReadCollider_ContactSkin ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider extra separation skin around the shape.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_Contains()

R2Bool r2ReadCollider_Contains ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Test whether the live world contains this collider handle.

A removed/stale handle returns false. Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_Density()

R2Real r2ReadCollider_Density ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider mass per unit volume.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_Friction()

R2Real r2ReadCollider_Friction ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider friction coefficient.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_FrictionCombineRule()

uint32_t r2ReadCollider_FrictionCombineRule ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider friction combination rule (R2_COMBINE_*).

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_IsEnabled()

R2Bool r2ReadCollider_IsEnabled ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return whether the collider is enabled.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_IsSensor()

R2Bool r2ReadCollider_IsSensor ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return whether the collider is a sensor (detects overlaps without contact forces).

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_IsVoxels()

R2Bool r2ReadCollider_IsVoxels ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return whether the collider is a voxel shape.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_Mass()

R2Real r2ReadCollider_Mass ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider mass.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_MassProperties()

struct R2MassProperties r2ReadCollider_MassProperties ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider local mass properties.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_Parent()

struct R2RigidBodyHandle r2ReadCollider_Parent ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Read the parent body handle during a callback; a standalone collider returns an invalid handle with OK status.

◆ r2ReadCollider_Position()

struct R2Pose r2ReadCollider_Position ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider world-space pose.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_PositionWrtParent()

struct R2Pose r2ReadCollider_PositionWrtParent ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider pose relative to its parent rigid body, or its world-space pose if it has no parent.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_Restitution()

R2Real r2ReadCollider_Restitution ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider restitution coefficient.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_RestitutionCombineRule()

uint32_t r2ReadCollider_RestitutionCombineRule ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider restitution combination rule (R2_COMBINE_*).

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_Rotation()

struct R2Rotation r2ReadCollider_Rotation ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider world-space rotation.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_ShapeIdentity()

size_t r2ReadCollider_ShapeIdentity ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return a process-local geometry identity for caching, not a serializable ID.

Keep a shared-shape clone alive while using it as a cache key. Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_SoftBody()

struct R2SoftBodyHandle r2ReadCollider_SoftBody ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the soft body owning this deformable collider, or an invalid handle for any other collider.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_SolverGroups()

struct R2InteractionGroups r2ReadCollider_SolverGroups ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider contact-force filtering groups.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_Translation()

struct R2Vector r2ReadCollider_Translation ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider world-space translation.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_UserData()

struct R2UserData r2ReadCollider_UserData ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider application-owned 128-bit user value.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_ValidateHandle()

R2Status r2ReadCollider_ValidateHandle ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Validate the index and generation in the live owning world.

Cannot detect a world pointer that has already been freed. Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_Volume()

R2Real r2ReadCollider_Volume ( const struct R2ReadContext * context,
struct R2ColliderHandle handle )

Return the collider current volume.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadCollider_VoxelAtFlatId()

struct R2VoxelQuery r2ReadCollider_VoxelAtFlatId ( const struct R2ReadContext * context,
struct R2ColliderHandle handle,
uint32_t id )

Return voxel information at a flat index; found = 0 if absent.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadColliderCount()

size_t r2ReadColliderCount ( const struct R2ReadContext * context)

Return the number of collider objects in the world.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadColliderHandles()

size_t r2ReadColliderHandles ( const struct R2ReadContext * context,
struct R2ColliderHandle * buffer,
size_t capacity )

Copy entity handles.

Uses only the callback-scoped read context; never retain the context.

See also
Arrays and output buffers

◆ r2ReadPdController_RigidBodyCorrection()

struct R2VelocityCorrection r2ReadPdController_RigidBodyCorrection ( const struct R2ReadContext * context,
const struct R2PdController * controller,
struct R2RigidBodyHandle body,
struct R2Pose target_pose,
struct R2Vector target_linvel,
R2AngVector target_angvel )

Compute a PD velocity correction from callback-visible body state.

Neither the body nor the controller is modified. The context is valid only during its callback.

◆ r2ReadPidController_RigidBodyCorrection()

struct R2VelocityCorrection r2ReadPidController_RigidBodyCorrection ( const struct R2ReadContext * context,
struct R2PidController * controller,
R2Real dt,
struct R2RigidBodyHandle body,
struct R2Pose target_pose,
struct R2Vector target_linvel,
R2AngVector target_angvel )

Compute a velocity correction from callback-visible body state, updating the PID controller history.

The context is valid only during its callback.

◆ r2ReadRigidBody_AdditionalPgsIterations()

size_t r2ReadRigidBody_AdditionalPgsIterations ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body additional PGS iterations for connected bodies.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_AdditionalSolverIterations()

size_t r2ReadRigidBody_AdditionalSolverIterations ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body additional solver iterations for connected bodies.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_AngularDamping()

R2Real r2ReadRigidBody_AngularDamping ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body angular damping coefficient.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_Angvel()

R2AngVector r2ReadRigidBody_Angvel ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

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

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_BodyType()

uint32_t r2ReadRigidBody_BodyType ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

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

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_CenterOfMass()

struct R2Vector r2ReadRigidBody_CenterOfMass ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body world-space center of mass.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_Colliders()

size_t r2ReadRigidBody_Colliders ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle,
struct R2ColliderHandle * buffer,
size_t capacity )

Copy attached collider handles.

Uses only the callback-scoped read context; never retain the context.

See also
Arrays and output buffers

◆ r2ReadRigidBody_Contains()

R2Bool r2ReadRigidBody_Contains ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Test whether the live world contains this rigid body handle.

A removed/stale handle returns false. Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_DominanceGroup()

int8_t r2ReadRigidBody_DominanceGroup ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body signed dominance group.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_GravityScale()

R2Real r2ReadRigidBody_GravityScale ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body gravity multiplier.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_IsCcdActive()

R2Bool r2ReadRigidBody_IsCcdActive ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

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

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_IsCcdEnabled()

R2Bool r2ReadRigidBody_IsCcdEnabled ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return whether the rigid body is using continuous collision detection.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_IsDynamic()

R2Bool r2ReadRigidBody_IsDynamic ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return whether the rigid body is dynamic.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_IsEnabled()

R2Bool r2ReadRigidBody_IsEnabled ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return whether the rigid body is enabled.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_IsFastRotationAllowed()

R2Bool r2ReadRigidBody_IsFastRotationAllowed ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

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

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_IsFixed()

R2Bool r2ReadRigidBody_IsFixed ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return whether the rigid body is fixed.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_IsKinematic()

R2Bool r2ReadRigidBody_IsKinematic ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return whether the rigid body is kinematic.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_IsMoving()

R2Bool r2ReadRigidBody_IsMoving ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return whether the rigid body is moving.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_IsSleeping()

R2Bool r2ReadRigidBody_IsSleeping ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return whether the rigid body is sleeping.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_IsSoftFrame()

R2Bool r2ReadRigidBody_IsSoftFrame ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return whether the rigid body is a soft-body proxy.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_KineticEnergy()

R2Real r2ReadRigidBody_KineticEnergy ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body kinetic energy.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_LinearDamping()

R2Real r2ReadRigidBody_LinearDamping ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body linear damping coefficient.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_Linvel()

struct R2Vector r2ReadRigidBody_Linvel ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body world-space linear velocity.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_LocalCenterOfMass()

struct R2Vector r2ReadRigidBody_LocalCenterOfMass ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body body-local center of mass.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_LockedAxes()

uint8_t r2ReadRigidBody_LockedAxes ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body translation/rotation lock bitmask.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_Mass()

R2Real r2ReadRigidBody_Mass ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body mass.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_NextPosition()

struct R2Pose r2ReadRigidBody_NextPosition ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body next kinematic world-space pose.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_Position()

struct R2Pose r2ReadRigidBody_Position ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body world-space pose.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_Rotation()

struct R2Rotation r2ReadRigidBody_Rotation ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body world-space rotation.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_SoftBody()

struct R2SoftBodyHandle r2ReadRigidBody_SoftBody ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the associated soft-body handle, or an invalid handle if this is not a soft proxy.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_SoftCcdPrediction()

R2Real r2ReadRigidBody_SoftCcdPrediction ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body soft-CCD prediction distance.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_Translation()

struct R2Vector r2ReadRigidBody_Translation ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Return the rigid body world-space translation.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_UserData()

struct R2UserData r2ReadRigidBody_UserData ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

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

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_UserForce()

struct R2Vector r2ReadRigidBody_UserForce ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

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

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_UserTorque()

R2AngVector r2ReadRigidBody_UserTorque ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

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

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_ValidateHandle()

R2Status r2ReadRigidBody_ValidateHandle ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle )

Validate the index and generation in the live owning world.

Cannot detect a world pointer that has already been freed. Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBody_VelocityAtPoint()

struct R2Vector r2ReadRigidBody_VelocityAtPoint ( const struct R2ReadContext * context,
struct R2RigidBodyHandle handle,
struct R2Vector point )

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

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBodyCount()

size_t r2ReadRigidBodyCount ( const struct R2ReadContext * context)

Return the number of rigid body objects in the world.

Uses only the callback-scoped read context; never retain the context.

◆ r2ReadRigidBodyHandles()

size_t r2ReadRigidBodyHandles ( const struct R2ReadContext * context,
struct R2RigidBodyHandle * buffer,
size_t capacity )

Copy entity handles.

Uses only the callback-scoped read context; never retain the context.

See also
Arrays and output buffers

◆ r2ReadRigidBodyReadStates()

size_t r2ReadRigidBodyReadStates ( const struct R2ReadContext * context,
const struct R2RigidBodyHandle * handles,
size_t handle_count,
struct R2RigidBodyState * states,
size_t capacity )

Copy callback-visible body states in the supplied handle order.

All handles must belong to the context world.

See also
Arrays and output buffers