Uh oh!
There was an error while loading. Please reload this page.
feat(lambda-rs): add 2D colliders - #195
Conversation
…ther minor updates.
…orce is 0 in both dimensions
…, mass recomputing, and slot allocation
…ify collider attachment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Adds 2D collider support to the existing 2D rigid-body physics surface, including a backend implementation (Rapier), public builder APIs, integration tests, and a demo to exercise the new behavior.
Changes:
- Introduces
Collider2Dhandle types, shape enums, materials, andCollider2DBuilderwith validation inlambda-rs. - Implements Rapier-backed collider attachment (circle/rectangle/capsule/convex polygon) with compound-collider support and material combine semantics in
lambda-rs-platform. - Adds integration tests and a new
physics_colliders_2ddemo plus accompanying documentation/spec updates.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/specs/physics/colliders-2d.md | New draft spec defining 2D collider API/behavior/validation requirements. |
| docs/specs/README.md | Adds the colliders spec to the specs index and updates metadata. |
| demos/physics/src/bin/physics_colliders_2d.rs | New visual/demo app exercising collider shapes, materials, density, offsets/rotation, and compound colliders. |
| demos/physics/Cargo.toml | Registers the new physics_colliders_2d demo binary under physics-2d. |
| demos/README.md | Documents physics demos and how to run the new colliders demo. |
| crates/lambda-rs/tests/integration.rs | Adds a top-level integration test entrypoint and gates physics tests behind physics-2d. |
| crates/lambda-rs/tests/physics_2d/mod.rs | Adds a physics integration test module root and basic smoke tests. |
| crates/lambda-rs/tests/physics_2d/colliders.rs | Integration tests for collider shapes and local-rotation behavior. |
| crates/lambda-rs/tests/physics_2d/materials.rs | Integration tests validating friction/restitution/density effects. |
| crates/lambda-rs/tests/physics_2d/compound_colliders.rs | Integration tests validating compound colliders affect collision extent. |
| crates/lambda-rs/src/physics/mod.rs | Wires in and re-exports the new collider module/types. |
| crates/lambda-rs/src/physics/collider_2d.rs | Implements public collider API, validation, and backend calls. |
| crates/lambda-rs/src/physics/rigid_body_2d.rs | Adds internal helpers for backend slot access and “live handle” validation. |
| crates/lambda-rs-platform/src/physics/mod.rs | Re-exports the new backend collider error type. |
| crates/lambda-rs-platform/src/physics/rapier2d.rs | Adds collider storage/attachment, material combine encoding, and mass-planning for density-driven mass semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
✅ Coverage Report📊 View Full HTML Report (download artifact) Overall Coverage
Changed Files in This PR
PR Files Coverage: 89.93% (1706/1897 lines) Generated by cargo-llvm-cov · Latest main coverage Last updated: 2026-03-21 23:18:34 UTC · Commit: |
Summary
Add 2D collider support on top of the rigid body implementation, including
public builder APIs in
lambda-rs, Rapier-backed shape attachment inlambda-rs-platform, integration coverage, and a demo that exercises material,density, local transform, and compound-collider behavior.
This PR introduces circle, rectangle, capsule, and convex polygon colliders,
supports attaching multiple colliders to a single rigid body, and verifies
collision response through integration tests and a visual demo.
Related Issues
N/A
Changes
Collider2D,ColliderShape2D,Collider2DBuilder, and collidervalidation/error handling to
lambda-rsattachment to
lambda-rs-platformrigid body
to collider construction
compound-collider behavior
physics_colliders_2ddemo covering primitives, materials,density, local rotation, and compound colliders
lambda-rsand reduce backend errorhandling to backend-owned failures
Rapier combine rules
synchronization
Type of Change
Affected Crates
lambda-rslambda-rs-platformlambda-rs-argslambda-rs-loggingdemos/physicsChecklist
cargo +nightly fmt --all)cargo clippy --workspace --all-targets -- -D warnings)cargo test --workspace)Testing
Commands run:
Manual verification steps (if applicable):
cargo run -p lambda-demos-physics --bin physics_colliders_2d --features physics-2dthe floor, ramp, walls, and divider
density changes response to the applied impulse
Screenshots/Recordings
Not included in this draft.
Platform Testing
Additional Notes
tests were previously observed failing independently of the collider
simplification work and should be evaluated separately before merge.