Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 16.5 — A Test Ride
3D Web · Example 2 of 2

The bike flips over, and comes back

A small game is a loop of input, physics and camera: held keys or buttons set forces, the world steps at a fixed rate, the camera follows, and a watchdog resets the bike when it falls over. Script the input with fixed steps and the whole ride becomes testable.

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

Add a boost key (B) that doubles the pedal force while held.

02

Make the watchdog reset a fallen bike after half a second instead of one.

Explain it without notes

01

Walk through one frame of the test ride: from a held key to a moved camera.

02

Why does the ride use forces and damping instead of setting the bike's velocity directly?

The bike flips over, and comes back
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

rolling                  x 2.46 | speed 2.23 m/s | y -0.00 | tilt -0.0°
0.67 s after the kick    x 4.31 | speed 1.82 m/s | y 0.86 | tilt 83.3°
1.5 s later              x -0.00 | speed 0.00 m/s | y -0.00 | tilt -0.0°
after end(): track in the scene: false | wheel speed back to 1.667 m/s