Merged
Conversation
…ther minor updates.
…orce is 0 in both dimensions
…, mass recomputing, and slot allocation
…ify collider attachment
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.
✅ 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.