-
Notifications
You must be signed in to change notification settings - Fork 2
[Feature] 2D trigger volumes #204
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 trigger volumes to the 2D physics API so gameplay code can detect overlap
enter and exit events without generating physical response.
Current State
The collision event system is intentionally limited to solid contacts.
Scope
Goals:
- Add a trigger collider configuration path on
Collider2DBuilder - Emit trigger enter and exit events separately from solid collision events
- Preserve the existing collision event semantics for solid contacts
- Ensure triggers do not participate in solver response
Non-Goals:
- Complex trigger filtering rules beyond layers and masks
- Trigger callbacks during backend simulation
- 3D trigger support
Proposed API
pub struct TriggerEvent {
pub kind: TriggerEventKind,
pub body_a: RigidBody2D,
pub body_b: RigidBody2D,
}
pub enum TriggerEventKind {
Entered,
Exited,
}
impl PhysicsWorld2D {
pub fn trigger_events(&self) -> impl Iterator<Item = TriggerEvent>;
}
impl Collider2DBuilder {
pub fn with_trigger(self, is_trigger: bool) -> Self;
}Acceptance Criteria
- Trigger colliders can be configured through the public builder API
- Trigger pairs emit enter and exit events
- Trigger pairs do not produce physical resolution
- Trigger events remain distinct from solid collision events
- Layer and mask filtering applies consistently to triggers
- Integration tests cover trigger enter, steady overlap, and exit
- A demo or tutorial shows trigger usage
Affected Crates
lambda-rs, lambda-rs-platform
Notes
- This should likely map to Rapier sensor colliders internally.
- Trigger semantics should be body-oriented by default for consistency with
collision events.
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