A scaled parent, add() and attach()
The orange ball is a child of a parent with scale 2; the blue ball is moved with attach. The grid is 10 × 10 units.
A point has different numbers depending on what you measure it from. The same wheel is (1, 0, 0) from its frame and (2, 0, −1) from the world, and the GPU carries it through camera, clip and screen space before a pixel is lit.
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.
A group named pivot sits at (3, 0, 0). Add a ball to it at local (0, 1, 0). Print the ball's world position, then turn pivot 90° around z and print it again.
Write a function worldPositionOf(object) that returns a new Vector3, and explain why it is better than reading object.position.
Explain it without notes
A wheel is a child of a frame, and the frame is turned 90° and moved to x = 2. How do you get the wheel's position in world space, and what do you expect for a local position of (1, 0, 0)?
Explain the difference between parent.add(child) and parent.attach(child), with a case where you need attach.
Console
Nothing logged yet.Expected console output
child local position (1, 0, 0), world position (2, 0, 0)
child scale (1, 1, 1), world scale (2, 2, 2) (radius 0.2 now looks like 0.4)
attach(): world (2, 0, 0) -> (2, 0, 0), local is now (-2, 0, 0)
add(): world (2, 0, 0) -> (5, 0, 0), local is still (1, 0, 0)