Implement a physics engine (C or Zig)
Current State
The engine has no physics. engine/components/RigidBodyComponent.zig and ColliderComponent.zig are stubs with no backing simulation.
Split: this issue is now Phase 1 — backend + rigid bodies + collision. Queries, triggers, and debug visualization moved to the follow-up #34 to keep this shippable.
Goal (Phase 1)
Pick a physics backend (C or Zig, no C++ runtime dependency), wrap it, and get rigid bodies colliding under gravity, driven by the existing components.
Tasks
- Evaluate backends: Jolt (C++ — would need a C shim), Box2D/box2c (2D), ReactPhysics3D, Mach physics (Zig), or a minimal custom impl. Decide and document.
- Zig binding/wrapper layer around the chosen library (or the custom module)
- Collision primitives: sphere, box, capsule (mesh → #34 if heavy)
- Rigid body dynamics with configurable gravity; integrate the fixed-timestep loop
- Collision detection + response (restitution/friction basics)
- Wire
RigidBodyComponent+ColliderComponentinto the ECS; sync transforms both ways - Document performance characteristics and limitations
Acceptance Criteria (Phase 1)
- Rigid bodies fall under gravity and collide/rest on static colliders.
- Sphere/box/capsule colliders work and integrate with the component system.
- No C++ runtime dependency leaks into the engine (C ABI only).
Related
- #34 (queries/triggers/debug draw), #31 (closed) (Play Mode to test), #3 (closed) (debug gizmos).
Edited by Bruno Massa