Skip to content

[Feature] Advanced collider-level collision details #206

Description

@vmarcella

Overview

Add an advanced API that exposes collider-level contact information for users
who need per-shape detail, while keeping the default public event system
body-oriented.

Current State

The public event stream aggregates collider pairs into one RigidBody2D pair.
That is the correct default for gameplay code, but it hides which attached
shape on a compound body actually participated in contact.

Scope

Goals:

  • Add an opt-in advanced collision view for per-collider detail
  • Preserve the current body-oriented event stream as the default API
  • Avoid leaking backend vendor types into the public surface
  • Define stable handle types for colliders if needed

Non-Goals:

  • Replacing the body-oriented API
  • Per-substep callbacks
  • Full backend manifold exposure

Proposed API

pub struct ColliderCollisionEvent {
  pub kind: CollisionEventKind,
  pub collider_a: Collider2D,
  pub collider_b: Collider2D,
  pub body_a: RigidBody2D,
  pub body_b: RigidBody2D,
  pub contact_point: Option<[f32; 2]>,
  pub normal: Option<[f32; 2]>,
  pub penetration: Option<f32>,
}

impl PhysicsWorld2D {
  pub fn collider_collision_events(
    &self,
  ) -> impl Iterator<Item = ColliderCollisionEvent>;
}

Acceptance Criteria

  • A public advanced event API exists for collider-level detail
  • The default body-oriented event stream remains unchanged
  • Collider handles are stable and documented if newly introduced
  • Compound bodies can be inspected at both body and collider granularity
  • Integration tests cover multiple colliders on one body
  • Docs clearly state when users should prefer body events vs.
    collider events

Affected Crates

lambda-rs, lambda-rs-platform

Notes

  • This should not be treated as the primary gameplay API.
  • The design is stronger if the same backend data can feed both views.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestlambda-rsIssues pertaining to the core frameworklambda-rs-platformIssues pertaining to the dependency & platform wrappersphysicsAll things related to physics

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions