LookLightweight
Scene graph & layout
How objects nest and move together.
How objects are grouped and positioned relative to each other. Rotate a group and everything inside turns with it; a moon orbits a planet that orbits a sun. Most “why is it over there” bugs live here.
- Breaks when
- world vs local space confusion
- Also called
- Object3D hierarchy, groups, transform parenting
Prompts
Orrery with nested groups
Three.js: a sun at the origin; three planet groups rotating at different speeds, each holding a planet mesh offset on its x-axis and a moon group that rotates faster and holds a moon. Draw each orbit as a LineLoop in the parent’s space. Add an HTML overlay that prints the world position of the innermost moon via getWorldPosition every second, to demonstrate local versus world space.
Layout in 3D, responsive
Arrange 9 product cards (planes with textures) in 3D with a layout function: at width ≥ 1024 a 3×3 grid facing the camera, below that a horizontal arc of 9 with 12° steps. Recompute positions on resize and tween each card to its new spot over 600 ms. Cards are children of one group; only the group is rotated by the pointer.
Pivot without math
Explain and implement three pivot changes using only the scene graph: rotate a door around its hinge, orbit a camera around a target, and spin a model around its bounding-box center rather than its origin. Each solved by wrapping the object in a group and offsetting, no matrix math.
Related
Resources · 1
- three.js manual: scene graphmrdoobsite · code · demoApr 28, 2026