Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 16.6 — Build: The Test Ride
3D Web · Example 1 of 2

The brakes on their own

The real createBrakes(), inlined. The pads switch on and off every 45 frames so you can see the glow.

The showroom gets a Test ride button. Rapier loads only when it is pressed; then the bike rides a track with a ramp, driven by held keys or on-screen buttons, followed by the camera, reset when it falls, with brake pads that glow while braking. The brakes are this phase's part.

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.

01

Show the current speed in km/h next to the ride buttons.

02

Add the brakes' price to panel.js as 65 instead of 50.

Explain it without notes

01

Why does the build load Rapier with import(), and what does end() clean up?

02

How do keyboard, mouse and touch all drive the same ride?

The brakes on their own
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

brakes: 2 calipers, at 0.56, 0.69 and -0.50, 0.68
pad glow released: 0
pad glow braking: 1.5 | one material, so both calipers glow together: true