threejs-physics
Installation
SKILL.md
Physics with Rapier
Rapier (@dimforge/rapier3d-compat 0.21, @react-three/rapier 2.2) is the default physics engine for three.js
work: WASM, deterministic, with character controllers and good React bindings. Most physics bugs are scale and
shape problems, not engine problems: bodies in centimeters fall 100 times too slowly, triangle-mesh colliders on
moving bodies tunnel or explode, and rendering at a variable rate while stepping at it makes motion jitter.
Process
- Inspect every model that gets a collider (
threejs-model-inspect): scale must be meters (fixscale-largefirst; physics in centimeters behaves like slow motion), and note which nodes are the floor, walls and props. - Choose collider shapes per object, cheapest that fits: