pub trait EventHandler: Send + Sync {
    fn handle_collision_event(
        &self,
        bodies: &RigidBodySet,
        colliders: &ColliderSet,
        event: CollisionEvent,
        contact_pair: Option<&ContactPair>
    ); }
Expand description

Trait implemented by structures responsible for handling events generated by the physics engine.

Implementors of this trait will typically collect these events for future processing.

Required Methods

Handle a collision event.

A collision event is emitted when the state of intersection between two colliders changes.

Parameters
  • event - The collision event.
  • bodies - The set of rigid-bodies.
  • colliders - The set of colliders.
  • contact_pair - The current state of contacts between the two colliders. This is set ot None if at least one of the collider is a sensor (in which case no contact information is ever computed).

Implementations on Foreign Types

Implementors