-
Notifications
You must be signed in to change notification settings - Fork 2
[Feature] Persistent 2D contact events #203
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestlambda-rsIssues pertaining to the core frameworkIssues pertaining to the core frameworklambda-rs-platformIssues pertaining to the dependency & platform wrappersIssues pertaining to the dependency & platform wrappersphysicsAll things related to physicsAll things related to physics
Description
Overview
Add an optional persistent-contact event mode for PhysicsWorld2D so
gameplay code can observe pairs that remain in contact across consecutive
steps without reconstructing that state manually from Started and Ended.
Current State
The public API only exposes CollisionEventKind::{Started, Ended} in
crates/lambda-rs/src/physics/mod.rs. Users who need "stay" semantics must
cache active pairs in gameplay code and rebuild that view themselves.
Scope
Goals:
- Add an explicit persistent-contact event shape or access pattern
- Preserve the existing
StartedandEndedsemantics - Keep the public API body-oriented by default
- Define whether persistent events fire once per step or once per substep
Non-Goals:
- Trigger volumes
- Per-collider event streams as the default API
- Contact impulse reporting in the first iteration
Proposed API
pub enum CollisionEventKind {
Started,
Stayed,
Ended,
}
impl PhysicsWorld2D {
pub fn collision_events(&self) -> impl Iterator<Item = CollisionEvent>;
}Acceptance Criteria
- A persistent-contact API is defined and documented
- Compound-body aggregation still produces one body-pair event
-
Startedfires once on contact begin - Persistent contact state is available on later touching steps
-
Endedfires once when the pair separates - Integration tests cover steady contact across multiple steps
- Demo or tutorial coverage explains when to use this over
Started/Ended
Affected Crates
lambda-rs, lambda-rs-platform
Notes
- Adding
Stayeddirectly tocollision_events()increases event volume. - A separate iterator may be cleaner if most users only need enter/exit.
- Deterministic ordering requirements should be defined before adding a
steady-state event stream.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestlambda-rsIssues pertaining to the core frameworkIssues pertaining to the core frameworklambda-rs-platformIssues pertaining to the dependency & platform wrappersIssues pertaining to the dependency & platform wrappersphysicsAll things related to physicsAll things related to physics