feat: migrate physics to Rapier via a ports & adapters boundary #122

Merged
akadmin merged 1 commit from feat/rapier-physics into main 2026-07-24 19:40:45 +00:00
Owner

Summary

Replaces ADR-0028's hand-rolled AABB-only physics with real Rapier dynamics,
reached through an engine-owned PhysicsBackend port
(src/physics/mod.rs) with a single RapierBackend adapter
(src/physics/rapier_backend.rs) — the only file in the codebase that
imports rapier3d/nalgebra. Collider/RigidBody stay plain,
serializable ECS data rather than becoming Rapier handles, so
EntityFile serialization, the Play/Stop snapshot, undo commands, and
the inspector all keep working with zero structural changes.

  • Full roadmap item 38 scope: rotated colliders, spheres/capsules,
    raycasts (world.raycast), triggers (reuse existing on_collision_*
    hooks, no new API), collision filtering (layer/mask), CCD opt-in.
  • Dynamic-vs-dynamic collisions now genuinely resolve instead of the old
    report-only behavior — an intentional gameplay improvement, called
    out in ADR-0063.
  • Editor inspector gained a shape-kind dropdown (Box/Sphere/Capsule),
    Is Trigger checkbox, Layer/Mask fields, and CCD Enabled checkbox, all
    through the existing Add/Set/undo command pattern.
  • New docs/physics.md reference doc; docs/adr/adr-0063-rapier-physics.md
    documents the port/adapter decision (supersedes ADR-0028).
  • Breaking .nmsscn change: Collider's half_extents field became
    a shape enum (pre-1.0 engine, no migration shim — existing scenes
    need Collider re-added by hand after loading).

Test plan

  • cargo test --all-targets — 530 tests pass (20 new/ported physics
    tests, incl. a genuine CCD tunneling-prevention proof)
  • cargo clippy --all-targets -- -D warnings clean
  • cargo fmt -- --check clean
  • Port boundary verified: grep -rn "rapier3d\|nalgebra" src/ outside
    src/physics/rapier_backend.rs returns nothing
  • Manual editor smoke test of the new inspector UI (shape dropdown,
    trigger/layer/mask/CCD fields) — not done in this session, no
    interactive display available

🤖 Generated with Claude Code

https://claude.ai/code/session_01MiL3vun3afMGxun4WoDDMa

## Summary Replaces ADR-0028's hand-rolled AABB-only physics with real Rapier dynamics, reached through an engine-owned `PhysicsBackend` port (`src/physics/mod.rs`) with a single `RapierBackend` adapter (`src/physics/rapier_backend.rs`) — the only file in the codebase that imports `rapier3d`/`nalgebra`. `Collider`/`RigidBody` stay plain, serializable ECS data rather than becoming Rapier handles, so `EntityFile` serialization, the Play/Stop snapshot, undo commands, and the inspector all keep working with zero structural changes. - Full roadmap item 38 scope: rotated colliders, spheres/capsules, raycasts (`world.raycast`), triggers (reuse existing `on_collision_*` hooks, no new API), collision filtering (layer/mask), CCD opt-in. - Dynamic-vs-dynamic collisions now genuinely resolve instead of the old report-only behavior — an intentional gameplay improvement, called out in ADR-0063. - Editor inspector gained a shape-kind dropdown (Box/Sphere/Capsule), Is Trigger checkbox, Layer/Mask fields, and CCD Enabled checkbox, all through the existing Add/Set/undo command pattern. - New `docs/physics.md` reference doc; `docs/adr/adr-0063-rapier-physics.md` documents the port/adapter decision (supersedes ADR-0028). - **Breaking `.nmsscn` change**: `Collider`'s `half_extents` field became a `shape` enum (pre-1.0 engine, no migration shim — existing scenes need `Collider` re-added by hand after loading). ## Test plan - [x] `cargo test --all-targets` — 530 tests pass (20 new/ported physics tests, incl. a genuine CCD tunneling-prevention proof) - [x] `cargo clippy --all-targets -- -D warnings` clean - [x] `cargo fmt -- --check` clean - [x] Port boundary verified: `grep -rn "rapier3d\|nalgebra" src/` outside `src/physics/rapier_backend.rs` returns nothing - [x] Manual editor smoke test of the new inspector UI (shape dropdown, trigger/layer/mask/CCD fields) — not done in this session, no interactive display available 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01MiL3vun3afMGxun4WoDDMa
feat: migrate physics to Rapier via a ports & adapters boundary (ADR-0063)
All checks were successful
CI / build (pull_request) Successful in 10m24s
d2a11d688e
Replaces ADR-0028's hand-rolled AABB-only physics with real Rapier
dynamics, reached through an engine-owned PhysicsBackend port
(src/physics/mod.rs) with a single RapierBackend adapter
(src/physics/rapier_backend.rs) — the only file in the codebase that
imports rapier3d/nalgebra. Collider/RigidBody stay plain, serializable
ECS data rather than becoming Rapier handles, so EntityFile
serialization, the Play/Stop snapshot, undo commands, and the inspector
all keep working unchanged.

Full roadmap item 38 scope: rotated colliders, spheres/capsules,
raycasts (world.raycast), triggers (reuse existing on_collision_*
hooks), collision filtering (layer/mask), CCD opt-in. Dynamic-vs-dynamic
collisions now genuinely resolve instead of the old report-only
behavior — an intentional gameplay improvement.

Editor inspector gained a shape-kind dropdown (Box/Sphere/Capsule),
Is Trigger checkbox, Layer/Mask fields, and CCD Enabled checkbox, all
through the existing Add/Set/undo command pattern with no structural
changes needed.

Breaking .nmsscn change: Collider's half_extents field became a shape
enum (pre-1.0 engine, no migration shim).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MiL3vun3afMGxun4WoDDMa
akadmin deleted branch feat/rapier-physics 2026-07-24 19:40:45 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
akadmin/NemesisEngine!122
No description provided.