Repository navigation
Physics: backend, rigid bodies and collision #64
Description
V2/first-playable slice (2026-10-01): Start with backend decision and injected per-runtime physics ownership, fixed-step/layer/query contracts and a simple falling-body demo. Register via DI/BRICKS; a null physics service must support device-free tests. Coordinate queries with #48 and layers with #91. Do not promise cross-platform deterministic physics; authoritative gameplay can own discrete simulation independently. Add PhysicsSettings through #43. Joint/vehicle/crowd features follow separately.
Current State
Turian has no physics: no rigid body or collider components and no simulation step.
Goal
Pick a managed physics backend, wrap it behind engine components, and get rigid bodies colliding under gravity on the
fixed-timestep loop. Queries, triggers and debug draw are the follow-up issue.
Tasks
- Evaluate backends and record the decision here: BepuPhysics v2 (pure C#, SIMD, fast), Jitter2 (pure C#),
or a native library behind a C ABI (Jolt via a C shim). Prefer pure managed code — no native runtime to package -
PhysicsSystemwrapper owning the simulation, stepped on a fixed timestep with interpolation for rendering -
RigidbodyComponent(mass, drag, kinematic flag, gravity scale, constraints) -
ColliderComponentfamily: box, sphere, capsule; static mesh collider if cheap with the chosen backend - Collision response (restitution, friction) via a
PhysicsMaterialDataAsset - Sync transforms both ways (scene → simulation for kinematic, simulation → scene for dynamic)
- Project physics settings: gravity, timestep, solver iterations
- Play Mode works on the deep-copied scene without leaking bodies between sessions
Acceptance Criteria
- Rigid bodies fall under gravity and collide with and rest on static colliders.
- Box, sphere and capsule colliders are editable in the Inspector and serialize.
- Entering and leaving Play Mode repeatedly leaves no simulation state behind.
- Documented performance characteristics and limitations.
Related
- Physics: queries, triggers, layers and debug draw #48 (physics queries, triggers and debug draw)
- Standard Library Components #36 (Standard Library Components)
Adapted from the TurianZ (Zig) engine: turian#21
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn progress
Activity
brmassa commentedon Sep 19, 2026
Backend notes from the competitor survey: Prowl uses Jitter Physics 2 (pure C#, MIT) with a broad collider/joint set, which makes it a proven option alongside BepuPhysics v2. Cysharp's MagicPhysX (PhysX bindings) is archived upstream, so it's ruled out. If a native engine is ever wanted, Cysharp csbindgen makes Rust backends (e.g. Rapier) practical.