collider_active_events
Event handlers are user-defined callbacks used to be
notified when two colliders start/stop touching. By default no collision event is generated by
the narrow-phase. In order to enable a collision event for a pair of colliders, at
least one of the involved colliders must have the corresponding event set as active. An event is activated for a collider
by setting its corresponding active events bit to 1:
- Setting the
R3_COLLISION_EVENTSbit to 1 enables the collision events involving the collider.
The active events of a collider can be set when the collider is created or after its creation:
/* Set the active events when the collider is created. */
R2ColliderDesc collider = r2BallColliderDesc(0.5);
collider.activeEvents = R2_COLLISION_EVENTS;
/* Set the active events after the collider creation. */
r2Collider_SetActiveEvents(collider_handle, R2_COLLISION_EVENTS);
assert(r2Collider_ActiveEvents(collider_handle) & R2_COLLISION_EVENTS);