Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 3.5 — The Scene Graph
3D Web · Example 1 of 2

A bike that rolls while its wheels turn

Two levels of movement: the bike's position (parent) and each wheel's rotation (child). The console shows the world position after each parent change.

Objects form a tree: a parent carries its children. Move, turn or scale the bike and the wheels follow, while each wheel still spins on its own. You learn how local and world positions relate and how to print the tree.

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 5 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Build a crank group that holds two pedals 0.17 m on each side of its centre and turns once every 2 seconds.

02

Print how many objects are below bike in a scene where the bike has two wheels with two meshes each.

Explain it without notes

01

A wheel is a child of the bike. The bike moves 1 m forward. What are the wheel's local and world positions before and after?

02

Why does a child turn around its parent's origin and not its own centre? How do you make a part spin about its own centre?

A bike that rolls while its wheels turn
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

start              | front wheel local x: 0.58 | world: 0.58, 0.35, 0
bike moved +1      | front wheel local x: 0.58 | world: 1.58, 0.35, 0
bike scaled x2     | front wheel local x: 0.58 | world: 2.16, 0.7, 0