Skip to content

Physics: backend, rigid bodies and collision #64

Open

Description

@brmassa

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
  • PhysicsSystem wrapper owning the simulation, stepped on a fixed timestep with interpolation for rendering
  • RigidbodyComponent (mass, drag, kinematic flag, gravity scale, constraints)
  • ColliderComponent family: box, sphere, capsule; static mesh collider if cheap with the chosen backend
  • Collision response (restitution, friction) via a PhysicsMaterial DataAsset
  • 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


Adapted from the TurianZ (Zig) engine: turian#21

Activity

  1. brmassa commented on Sep 19, 2026

    @brmassa
    ContributorAuthor

    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.

  2. added
    c:engineEngine core: scene graph, components, serialization, systems
    p:highHigh priority — fix in current sprint
    size:L~1-2 weeks — significant feature
    t:featureNew feature implementation
    on Sep 24, 2026
  3. moved this to Ready in ROADMAPon Sep 24, 2026
  4. removed this from the milestone on Sep 25, 2026
  5. moved this from Ready to Backlog in ROADMAPon Oct 13, 2026
  6. moved this from Backlog to Ready in ROADMAPon Oct 15, 2026
  7. moved this from Ready to In progress in ROADMAPon Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c:engineEngine core: scene graph, components, serialization, systemsp:highHigh priority — fix in current sprintsize:L~1-2 weeks — significant featuret:featureNew feature implementation

    Type

    No type

    Projects

    • Status
      In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions