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

Collider descriptions, material properties, sensor flags, and filtering. More...

Data Structures

struct  R2ColliderDesc
 Copyable collider construction data. More...
struct  R2ColliderHandle
 Copyable non-owning handle: world pointer plus entity index and generation. More...

Macros

#define R2_MASS_DENSITY   0
 Mass density.
#define R2_MASS_TOTAL   1
 Mass total.
#define R2_MASS_PROPERTIES   2
 Mass properties.
#define R2_COLLISION_EVENTS   1
 Enable collision-start and collision-stop events for this collider.
#define R2_CONTACT_FORCE_EVENTS   2
 Enable contact-force events for this collider, subject to its force threshold.
#define R2_COMBINE_AVERAGE   0
 Combine the two material coefficients by their arithmetic mean.
#define R2_COMBINE_MIN   1
 Use the smaller of the two material coefficients.
#define R2_COMBINE_MULTIPLY   2
 Multiply the two material coefficients.
#define R2_COMBINE_MAX   3
 Use the larger of the two material coefficients.
#define R2_COMBINE_CLAMPED_SUM   4
 Use the sum of the two material coefficients, clamped to [0, 1].
#define R2_COMBINE_GEOMETRIC_MEAN   5
 Use the geometric mean (square root of the product) of the two material coefficients.
#define R2_COLLISION_TYPES_DYNAMIC_DYNAMIC   1
 Active collision type bit: contacts between two dynamic bodies.
#define R2_COLLISION_TYPES_DYNAMIC_KINEMATIC   12
 Active collision type bit: contacts between a dynamic and a kinematic body.
#define R2_COLLISION_TYPES_DYNAMIC_FIXED   2
 Active collision type bit: contacts between a dynamic and a fixed body (or a collider without parent).
#define R2_COLLISION_TYPES_KINEMATIC_KINEMATIC   52224
 Active collision type bit: contacts between two kinematic bodies.
#define R2_COLLISION_TYPES_KINEMATIC_FIXED   8704
 Active collision type bit: contacts between a kinematic and a fixed body (or a collider without parent).
#define R2_COLLISION_TYPES_FIXED_FIXED   32
 Active collision type bit: contacts between two fixed bodies (or colliders without parent).
#define R2_COLLISION_TYPES_DEFAULT   15
 Default active collision types: dynamic-dynamic, dynamic-kinematic, and dynamic-fixed.
#define R2_FILTER_CONTACT_PAIRS   1
 Invoke the contact-pair filtering hook for this collider.
#define R2_FILTER_INTERSECTION_PAIR   2
 Invoke the sensor-intersection filtering hook for this collider.
#define R2_MODIFY_SOLVER_CONTACTS   4
 Invoke the solver-contact modification hook for this collider.
#define R2_GROUPS_AND   0
 Require both membership/filter intersections to be nonempty.
#define R2_GROUPS_OR   1
 Accept either membership/filter intersection if both participants select OR; otherwise use AND.

Typedefs

typedef struct R2ColliderDesc R2ColliderDesc
 Copyable collider construction data.
typedef struct R2ColliderHandle R2ColliderHandle
 Copyable non-owning handle: world pointer plus entity index and generation.

Functions

struct R2ColliderHandle r2InsertDeformableCollider (const struct R2ColliderDesc *collider, const struct R2SoftMeshBindingDesc *binding, struct R2RigidBodyHandle parent)
 Create a deformable collider bound to a soft-body cluster.
struct R2ColliderDesc r2DefaultColliderDesc (void)
 Return native default collider desc.
struct R2ColliderDesc r2BallColliderDesc (R2Real radius)
 Return a ball description with the supplied radius.
struct R2ColliderDesc r2CuboidColliderDesc (struct R2Vector half_extents)
 Return an axis-aligned box description with the supplied half-extents.
struct R2ColliderHandle r2InsertCollider (struct R2RigidBodyHandle parent, const struct R2ColliderDesc *desc)
 Insert a collider attached to a rigid body, using the world stored in its handle.
struct R2ColliderHandle r2InsertColliderWithoutParent (struct R2World *world, const struct R2ColliderDesc *desc)
 Insert a collider without a rigid-body parent.
R2Status r2RemoveCollider (struct R2ColliderHandle handle, R2Bool wake_up)
 Remove the collider and update its parent body mass properties.
size_t r2ColliderCount (const struct R2World *world)
 Return the number of collider objects in the world.
size_t r2ColliderHandles (const struct R2World *world, struct R2ColliderHandle *buffer, size_t capacity)
 Copy entity handles.
R2Bool r2Collider_Contains (struct R2ColliderHandle handle)
 Test whether the live world contains this collider handle.
struct R2Pose r2Collider_Position (struct R2ColliderHandle handle)
 Return the collider world-space pose.
struct R2Vector r2Collider_Translation (struct R2ColliderHandle handle)
 Return the collider world-space translation.
R2Real r2Collider_Friction (struct R2ColliderHandle handle)
 Return the collider friction coefficient.
R2Real r2Collider_Restitution (struct R2ColliderHandle handle)
 Return the collider restitution coefficient.
R2Bool r2Collider_IsSensor (struct R2ColliderHandle handle)
 Return whether the collider is a sensor (detects overlaps without contact forces).
struct R2RigidBodyHandle r2Collider_Parent (struct R2ColliderHandle handle)
 Return the parent body handle, or an invalid handle with OK status for a standalone collider.
R2Status r2Collider_SetPosition (struct R2ColliderHandle handle, struct R2Pose value)
 Set the collider world-space pose.
R2Status r2Collider_SetTranslation (struct R2ColliderHandle handle, struct R2Vector value)
 Set the collider world-space translation.
R2Status r2Collider_SetFriction (struct R2ColliderHandle handle, R2Real value)
 Set the collider friction coefficient.
R2Status r2Collider_SetRestitution (struct R2ColliderHandle handle, R2Real value)
 Set the collider restitution coefficient.
R2Status r2Collider_SetSensor (struct R2ColliderHandle handle, R2Bool value)
 Enable or disable a sensor (detects overlaps without contact forces) for the collider.
R2Status r2Collider_SetCollisionGroups (struct R2ColliderHandle handle, struct R2InteractionGroups value)
 Set the collider collision filtering groups.
R2Status r2Collider_SetUserData (struct R2ColliderHandle handle, struct R2UserData value)
 Set the collider application-owned 128-bit user value.
uint16_t r2Collider_ActiveCollisionTypes (struct R2ColliderHandle handle)
 Return the collider body-type collision activation bitmask (R2_COLLISION_TYPES_* bits).
uint32_t r2Collider_ActiveHooks (struct R2ColliderHandle handle)
 Return the collider physics-hook activation bitmask.
uint32_t r2Collider_FrictionCombineRule (struct R2ColliderHandle handle)
 Return the collider friction combination rule (R2_COMBINE_*).
uint32_t r2Collider_RestitutionCombineRule (struct R2ColliderHandle handle)
 Return the collider restitution combination rule (R2_COMBINE_*).
struct R2Pose r2Collider_PositionWrtParent (struct R2ColliderHandle handle)
 Return the collider pose relative to its parent rigid body, or its world-space pose if it has no parent.
R2Status r2Collider_SetRotation (struct R2ColliderHandle handle, struct R2Rotation value)
 Set the collider world-space rotation.
struct R2ColliderDesc r2RoundCuboidColliderDesc (struct R2Vector half_extents, R2Real border_radius)
 Return a rounded box description; half_extents exclude the added border_radius.
struct R2ColliderDesc r2CapsuleColliderDesc (struct R2Vector a, struct R2Vector b, R2Real radius)
 Return a capsule description with segment endpoints a/b and the supplied radius.
struct R2ColliderDesc r2SegmentColliderDesc (struct R2Vector a, struct R2Vector b)
 Return a segment description with endpoints a and b.
struct R2ColliderDesc r2TriangleColliderDesc (struct R2Vector a, struct R2Vector b, struct R2Vector c)
 Return a triangle description with vertices a, b, and c.
struct R2ColliderDesc r2HalfspaceColliderDesc (struct R2Vector normal)
 Return a half-space description bounded by a plane through the origin; normal points outward.
struct R2ColliderDesc r2CapsuleXColliderDesc (R2Real half_height, R2Real radius)
 Return a X-aligned capsule description; half_height is half the segment length, excluding caps.
struct R2ColliderDesc r2CapsuleYColliderDesc (R2Real half_height, R2Real radius)
 Return a Y-aligned capsule description; half_height is half the segment length, excluding caps.
struct R2SoftBodyHandle r2Collider_SoftBody (struct R2ColliderHandle handle)
 Return the soft body owning this deformable collider (a soft-body collision mesh), or an invalid handle for any other collider.
R2Status r2Collider_SetMassProperties (struct R2ColliderHandle handle, struct R2MassProperties properties)
 Set the collider local mass properties.
struct R2MassProperties r2Collider_MassProperties (struct R2ColliderHandle handle)
 Return the collider local mass properties.
R2Bool r2Collider_IsVoxels (struct R2ColliderHandle handle)
 Return whether the collider is a voxel shape.
struct R2VoxelQuery r2Collider_VoxelAtFlatId (struct R2ColliderHandle handle, uint32_t id)
 Return voxel information at a flat index; found = 0 if absent.
R2Status r2Collider_SetVoxel (struct R2ColliderHandle handle, struct R2VoxelKey key, R2Bool filled)
 Fill or clear the voxel at key; the collider must have a voxel shape.
R2Status r2Collider_SetDensity (struct R2ColliderHandle handle, R2Real value)
 Set the collider mass per unit volume.
R2Status r2Collider_SetMass (struct R2ColliderHandle handle, R2Real value)
 Set the collider mass.
R2Status r2Collider_SetEnabled (struct R2ColliderHandle handle, R2Bool value)
 Enable or disable the collider.
R2Status r2Collider_SetSolverGroups (struct R2ColliderHandle handle, struct R2InteractionGroups value)
 Set the collider contact-force filtering groups.
R2Status r2Collider_SetFrictionCombineRule (struct R2ColliderHandle handle, uint32_t value)
 Set the collider friction combination rule (R2_COMBINE_*).
R2Status r2Collider_SetRestitutionCombineRule (struct R2ColliderHandle handle, uint32_t value)
 Set the collider restitution combination rule (R2_COMBINE_*).
R2Status r2Collider_SetContactSkin (struct R2ColliderHandle handle, R2Real value)
 Set the collider extra separation skin around the shape.
R2Status r2Collider_SetContactForceEventThreshold (struct R2ColliderHandle handle, R2Real value)
 Set the collider force threshold for contact-force events.
R2Status r2Collider_SetActiveEvents (struct R2ColliderHandle handle, uint32_t value)
 Set the collider event-generation bitmask (R2_COLLISION_EVENTS and R2_CONTACT_FORCE_EVENTS).
R2Status r2Collider_SetActiveHooks (struct R2ColliderHandle handle, uint32_t value)
 Set the collider physics-hook activation bitmask.
R2Status r2Collider_SetActiveCollisionTypes (struct R2ColliderHandle handle, uint16_t value)
 Set the collider body-type collision activation bitmask.
struct R2Rotation r2Collider_Rotation (struct R2ColliderHandle handle)
 Return the collider world-space rotation.
struct R2InteractionGroups r2Collider_CollisionGroups (struct R2ColliderHandle handle)
 Return the collider collision filtering groups.
struct R2InteractionGroups r2Collider_SolverGroups (struct R2ColliderHandle handle)
 Return the collider contact-force filtering groups.
struct R2UserData r2Collider_UserData (struct R2ColliderHandle handle)
 Return the collider application-owned 128-bit user value.
uint32_t r2Collider_ActiveEvents (struct R2ColliderHandle handle)
 Return the collider event-generation bitmask (R2_COLLISION_EVENTS and R2_CONTACT_FORCE_EVENTS).
R2Real r2Collider_Mass (struct R2ColliderHandle handle)
 Return the collider mass.
R2Real r2Collider_Density (struct R2ColliderHandle handle)
 Return the collider mass per unit volume.
R2Real r2Collider_Volume (struct R2ColliderHandle handle)
 Return the collider current volume.
R2Real r2Collider_ContactSkin (struct R2ColliderHandle handle)
 Return the collider extra separation skin around the shape.
R2Real r2Collider_ContactForceEventThreshold (struct R2ColliderHandle handle)
 Return the collider force threshold for contact-force events.
R2Bool r2Collider_IsEnabled (struct R2ColliderHandle handle)
 Return whether the collider is enabled.
struct R2Aabb r2Collider_ComputeAabb (struct R2ColliderHandle handle)
 Return the current world-space axis-aligned bounds.
R2Status r2Collider_SetPositionWrtParent (struct R2ColliderHandle handle, struct R2Pose value)
 Set the collider pose relative to the parent rigid body.
R2Status r2Collider_ValidateHandle (struct R2ColliderHandle handle)
 Validate the index and generation in the live owning world.

Detailed Description

Collider descriptions, material properties, sensor flags, and filtering.

A parented collider's description pose is relative to its rigid body.

Macro Definition Documentation

◆ R2_COLLISION_EVENTS

#define R2_COLLISION_EVENTS   1

Enable collision-start and collision-stop events for this collider.

◆ R2_COLLISION_TYPES_DEFAULT

#define R2_COLLISION_TYPES_DEFAULT   15

Default active collision types: dynamic-dynamic, dynamic-kinematic, and dynamic-fixed.

◆ R2_COLLISION_TYPES_DYNAMIC_DYNAMIC

#define R2_COLLISION_TYPES_DYNAMIC_DYNAMIC   1

Active collision type bit: contacts between two dynamic bodies.

◆ R2_COLLISION_TYPES_DYNAMIC_FIXED

#define R2_COLLISION_TYPES_DYNAMIC_FIXED   2

Active collision type bit: contacts between a dynamic and a fixed body (or a collider without parent).

◆ R2_COLLISION_TYPES_DYNAMIC_KINEMATIC

#define R2_COLLISION_TYPES_DYNAMIC_KINEMATIC   12

Active collision type bit: contacts between a dynamic and a kinematic body.

◆ R2_COLLISION_TYPES_FIXED_FIXED

#define R2_COLLISION_TYPES_FIXED_FIXED   32

Active collision type bit: contacts between two fixed bodies (or colliders without parent).

◆ R2_COLLISION_TYPES_KINEMATIC_FIXED

#define R2_COLLISION_TYPES_KINEMATIC_FIXED   8704

Active collision type bit: contacts between a kinematic and a fixed body (or a collider without parent).

◆ R2_COLLISION_TYPES_KINEMATIC_KINEMATIC

#define R2_COLLISION_TYPES_KINEMATIC_KINEMATIC   52224

Active collision type bit: contacts between two kinematic bodies.

◆ R2_COMBINE_AVERAGE

#define R2_COMBINE_AVERAGE   0

Combine the two material coefficients by their arithmetic mean.

◆ R2_COMBINE_CLAMPED_SUM

#define R2_COMBINE_CLAMPED_SUM   4

Use the sum of the two material coefficients, clamped to [0, 1].

◆ R2_COMBINE_GEOMETRIC_MEAN

#define R2_COMBINE_GEOMETRIC_MEAN   5

Use the geometric mean (square root of the product) of the two material coefficients.

◆ R2_COMBINE_MAX

#define R2_COMBINE_MAX   3

Use the larger of the two material coefficients.

◆ R2_COMBINE_MIN

#define R2_COMBINE_MIN   1

Use the smaller of the two material coefficients.

◆ R2_COMBINE_MULTIPLY

#define R2_COMBINE_MULTIPLY   2

Multiply the two material coefficients.

◆ R2_CONTACT_FORCE_EVENTS

#define R2_CONTACT_FORCE_EVENTS   2

Enable contact-force events for this collider, subject to its force threshold.

◆ R2_FILTER_CONTACT_PAIRS

#define R2_FILTER_CONTACT_PAIRS   1

Invoke the contact-pair filtering hook for this collider.

◆ R2_FILTER_INTERSECTION_PAIR

#define R2_FILTER_INTERSECTION_PAIR   2

Invoke the sensor-intersection filtering hook for this collider.

◆ R2_GROUPS_AND

#define R2_GROUPS_AND   0

Require both membership/filter intersections to be nonempty.

◆ R2_GROUPS_OR

#define R2_GROUPS_OR   1

Accept either membership/filter intersection if both participants select OR; otherwise use AND.

◆ R2_MASS_DENSITY

#define R2_MASS_DENSITY   0

Mass density.

◆ R2_MASS_PROPERTIES

#define R2_MASS_PROPERTIES   2

Mass properties.

◆ R2_MASS_TOTAL

#define R2_MASS_TOTAL   1

Mass total.

◆ R2_MODIFY_SOLVER_CONTACTS

#define R2_MODIFY_SOLVER_CONTACTS   4

Invoke the solver-contact modification hook for this collider.

Typedef Documentation

◆ R2ColliderDesc

typedef struct R2ColliderDesc R2ColliderDesc

Copyable collider construction data.

Shape inputs are borrowed, never owned.

◆ R2ColliderHandle

typedef struct R2ColliderHandle R2ColliderHandle

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.

Function Documentation

◆ r2BallColliderDesc()

struct R2ColliderDesc r2BallColliderDesc ( R2Real radius)

Return a ball description with the supplied radius.

Returns a description without allocating or validating. Build/insert validates its fields.

◆ r2CapsuleColliderDesc()

struct R2ColliderDesc r2CapsuleColliderDesc ( struct R2Vector a,
struct R2Vector b,
R2Real radius )

Return a capsule description with segment endpoints a/b and the supplied radius.

Returns a description without allocating or validating. Build/insert validates its fields.

◆ r2CapsuleXColliderDesc()

struct R2ColliderDesc r2CapsuleXColliderDesc ( R2Real half_height,
R2Real radius )

Return a X-aligned capsule description; half_height is half the segment length, excluding caps.

Returns a description without allocating or validating. Build/insert validates its fields.

◆ r2CapsuleYColliderDesc()

struct R2ColliderDesc r2CapsuleYColliderDesc ( R2Real half_height,
R2Real radius )

Return a Y-aligned capsule description; half_height is half the segment length, excluding caps.

Returns a description without allocating or validating. Build/insert validates its fields.

◆ r2Collider_ActiveCollisionTypes()

uint16_t r2Collider_ActiveCollisionTypes ( struct R2ColliderHandle handle)

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

◆ r2Collider_ActiveEvents()

uint32_t r2Collider_ActiveEvents ( struct R2ColliderHandle handle)

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

◆ r2Collider_ActiveHooks()

uint32_t r2Collider_ActiveHooks ( struct R2ColliderHandle handle)

Return the collider physics-hook activation bitmask.

◆ r2Collider_CollisionGroups()

struct R2InteractionGroups r2Collider_CollisionGroups ( struct R2ColliderHandle handle)

Return the collider collision filtering groups.

◆ r2Collider_ComputeAabb()

struct R2Aabb r2Collider_ComputeAabb ( struct R2ColliderHandle handle)

Return the current world-space axis-aligned bounds.

◆ r2Collider_ContactForceEventThreshold()

R2Real r2Collider_ContactForceEventThreshold ( struct R2ColliderHandle handle)

Return the collider force threshold for contact-force events.

◆ r2Collider_ContactSkin()

R2Real r2Collider_ContactSkin ( struct R2ColliderHandle handle)

Return the collider extra separation skin around the shape.

◆ r2Collider_Contains()

R2Bool r2Collider_Contains ( struct R2ColliderHandle handle)

Test whether the live world contains this collider handle.

A removed/stale handle returns false.

◆ r2Collider_Density()

R2Real r2Collider_Density ( struct R2ColliderHandle handle)

Return the collider mass per unit volume.

◆ r2Collider_Friction()

R2Real r2Collider_Friction ( struct R2ColliderHandle handle)

Return the collider friction coefficient.

◆ r2Collider_FrictionCombineRule()

uint32_t r2Collider_FrictionCombineRule ( struct R2ColliderHandle handle)

Return the collider friction combination rule (R2_COMBINE_*).

◆ r2Collider_IsEnabled()

R2Bool r2Collider_IsEnabled ( struct R2ColliderHandle handle)

Return whether the collider is enabled.

◆ r2Collider_IsSensor()

R2Bool r2Collider_IsSensor ( struct R2ColliderHandle handle)

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

◆ r2Collider_IsVoxels()

R2Bool r2Collider_IsVoxels ( struct R2ColliderHandle handle)

Return whether the collider is a voxel shape.

◆ r2Collider_Mass()

R2Real r2Collider_Mass ( struct R2ColliderHandle handle)

Return the collider mass.

◆ r2Collider_MassProperties()

struct R2MassProperties r2Collider_MassProperties ( struct R2ColliderHandle handle)

Return the collider local mass properties.

◆ r2Collider_Parent()

struct R2RigidBodyHandle r2Collider_Parent ( struct R2ColliderHandle handle)

Return the parent body handle, or an invalid handle with OK status for a standalone collider.

◆ r2Collider_Position()

struct R2Pose r2Collider_Position ( struct R2ColliderHandle handle)

Return the collider world-space pose.

◆ r2Collider_PositionWrtParent()

struct R2Pose r2Collider_PositionWrtParent ( struct R2ColliderHandle handle)

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

◆ r2Collider_Restitution()

R2Real r2Collider_Restitution ( struct R2ColliderHandle handle)

Return the collider restitution coefficient.

◆ r2Collider_RestitutionCombineRule()

uint32_t r2Collider_RestitutionCombineRule ( struct R2ColliderHandle handle)

Return the collider restitution combination rule (R2_COMBINE_*).

◆ r2Collider_Rotation()

struct R2Rotation r2Collider_Rotation ( struct R2ColliderHandle handle)

Return the collider world-space rotation.

◆ r2Collider_SetActiveCollisionTypes()

R2Status r2Collider_SetActiveCollisionTypes ( struct R2ColliderHandle handle,
uint16_t value )

Set the collider body-type collision activation bitmask.

◆ r2Collider_SetActiveEvents()

R2Status r2Collider_SetActiveEvents ( struct R2ColliderHandle handle,
uint32_t value )

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

◆ r2Collider_SetActiveHooks()

R2Status r2Collider_SetActiveHooks ( struct R2ColliderHandle handle,
uint32_t value )

Set the collider physics-hook activation bitmask.

◆ r2Collider_SetCollisionGroups()

R2Status r2Collider_SetCollisionGroups ( struct R2ColliderHandle handle,
struct R2InteractionGroups value )

Set the collider collision filtering groups.

◆ r2Collider_SetContactForceEventThreshold()

R2Status r2Collider_SetContactForceEventThreshold ( struct R2ColliderHandle handle,
R2Real value )

Set the collider force threshold for contact-force events.

◆ r2Collider_SetContactSkin()

R2Status r2Collider_SetContactSkin ( struct R2ColliderHandle handle,
R2Real value )

Set the collider extra separation skin around the shape.

◆ r2Collider_SetDensity()

R2Status r2Collider_SetDensity ( struct R2ColliderHandle handle,
R2Real value )

Set the collider mass per unit volume.

◆ r2Collider_SetEnabled()

R2Status r2Collider_SetEnabled ( struct R2ColliderHandle handle,
R2Bool value )

Enable or disable the collider.

◆ r2Collider_SetFriction()

R2Status r2Collider_SetFriction ( struct R2ColliderHandle handle,
R2Real value )

Set the collider friction coefficient.

◆ r2Collider_SetFrictionCombineRule()

R2Status r2Collider_SetFrictionCombineRule ( struct R2ColliderHandle handle,
uint32_t value )

Set the collider friction combination rule (R2_COMBINE_*).

◆ r2Collider_SetMass()

R2Status r2Collider_SetMass ( struct R2ColliderHandle handle,
R2Real value )

Set the collider mass.

◆ r2Collider_SetMassProperties()

R2Status r2Collider_SetMassProperties ( struct R2ColliderHandle handle,
struct R2MassProperties properties )

Set the collider local mass properties.

◆ r2Collider_SetPosition()

R2Status r2Collider_SetPosition ( struct R2ColliderHandle handle,
struct R2Pose value )

Set the collider world-space pose.

For a collider attached to a rigid body, prefer SetPositionWrtParent: the body pose overwrites it at the next step.

◆ r2Collider_SetPositionWrtParent()

R2Status r2Collider_SetPositionWrtParent ( struct R2ColliderHandle handle,
struct R2Pose value )

Set the collider pose relative to the parent rigid body.

◆ r2Collider_SetRestitution()

R2Status r2Collider_SetRestitution ( struct R2ColliderHandle handle,
R2Real value )

Set the collider restitution coefficient.

◆ r2Collider_SetRestitutionCombineRule()

R2Status r2Collider_SetRestitutionCombineRule ( struct R2ColliderHandle handle,
uint32_t value )

Set the collider restitution combination rule (R2_COMBINE_*).

◆ r2Collider_SetRotation()

R2Status r2Collider_SetRotation ( struct R2ColliderHandle handle,
struct R2Rotation value )

Set the collider world-space rotation.

For a collider attached to a rigid body, prefer SetPositionWrtParent: the body pose overwrites it at the next step.

◆ r2Collider_SetSensor()

R2Status r2Collider_SetSensor ( struct R2ColliderHandle handle,
R2Bool value )

Enable or disable a sensor (detects overlaps without contact forces) for the collider.

◆ r2Collider_SetSolverGroups()

R2Status r2Collider_SetSolverGroups ( struct R2ColliderHandle handle,
struct R2InteractionGroups value )

Set the collider contact-force filtering groups.

◆ r2Collider_SetTranslation()

R2Status r2Collider_SetTranslation ( struct R2ColliderHandle handle,
struct R2Vector value )

Set the collider world-space translation.

For a collider attached to a rigid body, prefer SetPositionWrtParent: the body pose overwrites it at the next step.

◆ r2Collider_SetUserData()

R2Status r2Collider_SetUserData ( struct R2ColliderHandle handle,
struct R2UserData value )

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

◆ r2Collider_SetVoxel()

R2Status r2Collider_SetVoxel ( struct R2ColliderHandle handle,
struct R2VoxelKey key,
R2Bool filled )

Fill or clear the voxel at key; the collider must have a voxel shape.

◆ r2Collider_SoftBody()

struct R2SoftBodyHandle r2Collider_SoftBody ( struct R2ColliderHandle handle)

Return the soft body owning this deformable collider (a soft-body collision mesh), or an invalid handle for any other collider.

◆ r2Collider_SolverGroups()

struct R2InteractionGroups r2Collider_SolverGroups ( struct R2ColliderHandle handle)

Return the collider contact-force filtering groups.

◆ r2Collider_Translation()

struct R2Vector r2Collider_Translation ( struct R2ColliderHandle handle)

Return the collider world-space translation.

◆ r2Collider_UserData()

struct R2UserData r2Collider_UserData ( struct R2ColliderHandle handle)

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

◆ r2Collider_ValidateHandle()

R2Status r2Collider_ValidateHandle ( struct R2ColliderHandle handle)

Validate the index and generation in the live owning world.

Cannot detect a world pointer that has already been freed.

◆ r2Collider_Volume()

R2Real r2Collider_Volume ( struct R2ColliderHandle handle)

Return the collider current volume.

◆ r2Collider_VoxelAtFlatId()

struct R2VoxelQuery r2Collider_VoxelAtFlatId ( struct R2ColliderHandle handle,
uint32_t id )

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

◆ r2ColliderCount()

size_t r2ColliderCount ( const struct R2World * world)

Return the number of collider objects in the world.

◆ r2ColliderHandles()

size_t r2ColliderHandles ( const struct R2World * world,
struct R2ColliderHandle * buffer,
size_t capacity )

Copy entity handles.

See also
Arrays and output buffers

◆ r2CuboidColliderDesc()

struct R2ColliderDesc r2CuboidColliderDesc ( struct R2Vector half_extents)

Return an axis-aligned box description with the supplied half-extents.

Returns a description without allocating or validating. Build/insert validates its fields.

◆ r2DefaultColliderDesc()

struct R2ColliderDesc r2DefaultColliderDesc ( void )

Return native default collider desc.

This POD value owns no resources.

◆ r2HalfspaceColliderDesc()

struct R2ColliderDesc r2HalfspaceColliderDesc ( struct R2Vector normal)

Return a half-space description bounded by a plane through the origin; normal points outward.

Returns a description without allocating or validating. Build/insert validates its fields.

◆ r2InsertCollider()

struct R2ColliderHandle r2InsertCollider ( struct R2RigidBodyHandle parent,
const struct R2ColliderDesc * desc )

Insert a collider attached to a rigid body, using the world stored in its handle.

The parent handle is copied by value. The description is borrowed through this call. Invalid or removed parents fail without inserting a collider.

◆ r2InsertColliderWithoutParent()

struct R2ColliderHandle r2InsertColliderWithoutParent ( struct R2World * world,
const struct R2ColliderDesc * desc )

Insert a collider without a rigid-body parent.

The world owns the collider. The description is borrowed through this call.

◆ r2InsertDeformableCollider()

struct R2ColliderHandle r2InsertDeformableCollider ( const struct R2ColliderDesc * collider,
const struct R2SoftMeshBindingDesc * binding,
struct R2RigidBodyHandle parent )

Create a deformable collider bound to a soft-body cluster.

The world owns the collider; binding arrays are borrowed only during insertion.

◆ r2RemoveCollider()

R2Status r2RemoveCollider ( struct R2ColliderHandle handle,
R2Bool wake_up )

Remove the collider and update its parent body mass properties.

wake_up wakes the parent.

◆ r2RoundCuboidColliderDesc()

struct R2ColliderDesc r2RoundCuboidColliderDesc ( struct R2Vector half_extents,
R2Real border_radius )

Return a rounded box description; half_extents exclude the added border_radius.

Returns a description without allocating or validating. Build/insert validates its fields.

◆ r2SegmentColliderDesc()

struct R2ColliderDesc r2SegmentColliderDesc ( struct R2Vector a,
struct R2Vector b )

Return a segment description with endpoints a and b.

Returns a description without allocating or validating. Build/insert validates its fields.

◆ r2TriangleColliderDesc()

struct R2ColliderDesc r2TriangleColliderDesc ( struct R2Vector a,
struct R2Vector b,
struct R2Vector c )

Return a triangle description with vertices a, b, and c.

Returns a description without allocating or validating. Build/insert validates its fields.