feat(lambda-rs): Add 2D physics world for managing physics in 2D environments#176
feat(lambda-rs): Add 2D physics world for managing physics in 2D environments#176
Conversation
✅ Coverage Report📊 View Full HTML Report (download artifact) Overall Coverage
Changed Files in This PR
PR Files Coverage: 25.60% (316/1234 lines) Generated by cargo-llvm-cov · Latest main coverage Last updated: 2026-02-09 00:51:24 UTC · Commit: |
There was a problem hiding this comment.
Pull request overview
Adds an opt-in 2D physics world API to lambda-rs (feature-gated), backed by a Rapier-based platform backend, plus a minimal physics demo and accompanying documentation/specs to introduce and validate fixed-timestep stepping.
Changes:
- Introduce
lambda::physics::PhysicsWorld2D+ builder/validation behindlambda-rs/physics-2d, wired tolambda-rs-platform/physics-2d(Rapier 2D). - Add a new
lambda-demos-physicscrate with aphysics_falling_quaddemo showcasing fixed-timestep stepping and simple kinematic motion. - Add/extend docs: a 2D physics world spec, a falling-quad tutorial, and feature-flag documentation/index updates.
Reviewed changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/tutorials/physics/basics/falling-quad-kinematic.md | New tutorial walking through building the falling-quad demo and fixed-timestep loop. |
| docs/tutorials/README.md | Adds a Physics tutorial section linking the new tutorial. |
| docs/specs/physics/physics-world-2d.md | New spec defining the 2D physics world API, validation, stepping semantics, and feature gating. |
| docs/specs/README.md | Adds a Physics section linking the new 2D physics world spec. |
| docs/features.md | Documents the new physics-2d feature flags and their crate relationships. |
| demos/physics/src/lib.rs | New demo crate library stub / crate-level docs. |
| demos/physics/src/bin/physics_falling_quad.rs | New demo binary implementing fixed-timestep stepping + falling quad rendering. |
| demos/physics/Cargo.toml | New demos crate config; enables physics-2d by default and exposes validation passthrough features. |
| crates/lambda-rs/src/physics/mod.rs | New public PhysicsWorld2D API + builder + validation + unit tests (feature-gated via lib.rs). |
| crates/lambda-rs/src/lib.rs | Exposes pub mod physics behind physics-2d. |
| crates/lambda-rs/Cargo.toml | Adds physics-2d feature enabling the platform physics backend. |
| crates/lambda-rs-platform/src/physics/rapier2d.rs | New Rapier-backed internal 2D backend wrapper. |
| crates/lambda-rs-platform/src/physics/mod.rs | Adds platform physics module and re-export for the backend. |
| crates/lambda-rs-platform/src/lib.rs | Exposes platform physics module behind physics-2d. |
| crates/lambda-rs-platform/Cargo.toml | Adds optional rapier2d dependency and physics-2d feature. |
| Cargo.toml | Adds demos/physics to workspace members (kept out of default-members). |
| Cargo.lock | Locks new dependency graph additions (Rapier + transitive deps). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| status: "draft" | ||
| created: "2026-02-06T23:02:06Z" | ||
| last_updated: "2026-02-07T20:58:44Z" | ||
| version: "0.1.3" |
There was a problem hiding this comment.
Front-matter version is 0.1.3, but the Changelog section only contains an initial v0.1.0 entry. Please add changelog entries up to 0.1.3 (or adjust the front-matter version) to keep spec versioning consistent.
| version: "0.1.3" | |
| version: "0.1.0" |
Summary
Add an opt-in 2D physics world API (
PhysicsWorld2D) tolambda-rs, backed byRapier, and provide a minimal demo
and tutorial that render a falling 2D quad while stepping an empty physics
world.
Related Issues
Changes
lambda::physics::PhysicsWorld2DandPhysicsWorld2DBuilderbehind thephysics-2dfeature, including validation and fixed-timestep stepping.lambda_platform::physics::rapier2dbackend wrapper and wire it behindlambda-rs-platform/physics-2d.demos/physics) and a minimal fallingquad demo (
physics_falling_quad) that defaults tophysics-2denabled.docs/specs/physics/.docs/features.mdto documentphysics-2dfeature flags and theirdependency relationships.
Type of Change
Affected Crates
lambda-rslambda-rs-platformlambda-rs-argslambda-rs-loggingdemos/physics, docsChecklist
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_falling_quad.world steps each fixed tick.
Screenshots/Recordings
Platform Testing
Additional Notes