One parent only: add, add twice, attach, remove
No canvas needed: these are facts about the tree. Positions come from getWorldPosition after updateMatrixWorld().
Meshes, lights, cameras and groups are all Object3Ds with a position, rotation, scale and visibility. You learn add, remove, traverse and getObjectByName, and what happens when an object is hidden, scaled to 0, placed behind the camera or added twice.
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.
Write a function findAll(root, namePrefix) that returns every object whose name starts with a prefix.
A model's parent is scene. Write the line that moves it to rack but keeps it where it is on screen.
Explain it without notes
What is the difference between visible = false, scene.remove(obj) and scale.set(0, 0, 0)?
What happens if you add the same mesh to two different groups?
Console
Nothing logged yet.Expected console output
in left: left has 1 | right has 0 | world x = -1.5
added to right: left has 0 | right has 1 | world x = 2.5
added twice to right: right has 1 child
moved to scene: local x stays 0.5 | world x = 0.5 (its local number now means something else)
right.attach(wheel): local x = -1.5 | world x = 0.5
after remove: parent is null | right has 0 children
scene children: left, right