three-physics-rapier
Installation
SKILL.md
Rapier Physics in Three.js
What this builds
A production physics integration layer that couples a Rapier WASM physics world to a Three.js scene graph, with fixed-timestep simulation, rigid body/collider lifecycle management, transform sync from physics to render, debug wireframe visualization, and full cleanup on teardown. The finished system lets you tag meshes as dynamic/kinematic/fixed, attach collider shapes, and have physically-driven motion with zero per-frame allocation.
- Rapier WASM world initialized asynchronously with proper await pattern
- Fixed-timestep accumulator decoupled from render frame rate
- Rigid body + collider creation from Three.js mesh geometry
- Per-frame transform sync: physics world -> Three.js Object3D positions/rotations
- Character controller (KinematicCharacterController) for player-like movement
- Joints (revolute, prismatic, spherical, fixed) between bodies
- Debug wireframe renderer showing collider shapes
- Full disposal: bodies, colliders, joints, and the world itself