Strange positions: far, behind, huge, NaN
One ball is moved through five positions. After each render the console prints how many draw calls three.js sent. The picture shows the last state: two balls near the origin.
Every position in a 3D scene is three numbers, x, y and z, measured from one point called the origin. three.js uses a right-handed system with y pointing up, and it will happily accept numbers that are negative, enormous or not numbers at all.
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 code that puts a small ball at each corner of a square on the floor, 2 units on a side, centred on the origin. Print each corner.
Write a helper isUsable(position) that returns false for NaN, infinite or absurdly large (over 1e6) values.
Explain it without notes
Explain the right-handed coordinate system three.js uses, and what changes if a model comes from a left-handed tool.
A mesh vanishes after you set its position from a calculation. List what you check, in order.
Console
Nothing logged yet.Expected console output
at the origin: draw calls 1
z = -30 (far away): draw calls 1
z = 20 (behind the camera): draw calls 0
x = 1e9 (huge): draw calls 0
x = NaN: draw calls 1