CollisionContact Struct
Lightweight collision data passed to PhysicsBodyComponent event handlers. Contains the contact normal, penetration depth, and approximate contact point. For trigger pairs, Normal, Depth, and ContactPoint may be zero when no penetration resolution was performed.
public readonly struct CollisionContact
| Properties | |
|---|---|
| ContactPoint | Approximate world-space contact point (deepest penetration point when two points are present). See ContactPoint2 for the second point, if any. |
| ContactPoint2 | Second contact point when the manifold contains two points, otherwise System.Numerics.Vector2.Zero. Use ContactPointCount to distinguish a genuine second point from the default value. |
| ContactPointCount | Number of contact points available (0, 1, or 2). ... |
| Depth | Penetration depth along Normal. |
| ImpactSpeed | Closing speed along the contact normal at the moment of detection. Important: this value is only meaningful when received via OnCollisionHit, which uses Box2D's dedicated hit-event approach speed. When received via OnCollisionEnter, the value is always 0 — Box2D's normalVelocity is unreliable on the first contact frame. When received via Brine2D.ECS.Components.PhysicsBodyComponent.OnCollisionStay, the value is derived from the manifold's normalVelocity field, which can be noisy. Use OnCollisionHit with EnableHitEvents for impact-speed-based logic (e.g. collision sound volume). |
| Normal | Surface normal pointing away from the other collider toward this collider. |