Skip to main content

concinnity_core/components/
contact_event.rs

1// src/components/contact_event.rs
2
3use crate::ecs::Entity;
4
5/// Runtime-only event published by the physics system when two bodies collide
6/// hard enough to pass the world's contact impulse threshold. `a` is always a
7/// simulated prop entity; `b` is the other side's entity, or None when the
8/// other body has no entity (terrain, the floor slab, a character capsule).
9/// `normal` points from `a`'s surface toward `b`; `impulse` is the contact's
10/// total impulse magnitude (mass times velocity change). World authors never
11/// declare this type directly.
12#[derive(Debug, Clone, Copy)]
13pub struct ContactEvent {
14    /// The simulated prop entity on one side of the contact.
15    pub a: Entity,
16    /// The other side's entity, or `None` when that body has none.
17    pub b: Option<Entity>,
18    /// World-space contact point.
19    pub point: [f32; 3],
20    /// Contact normal, pointing from `a`'s surface toward `b`.
21    pub normal: [f32; 3],
22    /// Total contact impulse magnitude (mass times velocity change).
23    pub impulse: f32,
24}