Three crates on the stand
One physics step per frame for 240 frames, then it stops stepping. Watch the scene tree: the meshes are ordinary three.js objects.
A physics engine keeps its own world of bodies (things with mass and motion) and colliders (their shapes), applies gravity and contacts, and moves everything forward one step at a time. Rapier runs as WebAssembly: you must await RAPIER.init() before using it.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 4 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Add a second ball with restitution 0 next to the first, and print both heights.
Make the floor a fixed body explicitly, instead of a collider without a body.
Explain it without notes
What is the difference between a rigid body and a collider?
Why must you await RAPIER.init(), and what happens if you don't?
Console
Nothing logged yet.Expected console output
after 240 steps (4 s of physics):
crate 1: y 0.20, asleep: true
crate 2: y 0.20, asleep: true
crate 3: y 0.44, asleep: true