Nesting
Nesting is the technique of adding one or multiple objects—the child or children—to a parent object. A benefit of nesting is that you can create a hierarchal structure in which children show behavior relative to their parent. For instance, you can group one set of objects by nesting them in one parent and group another set of objects by nesting them in another parent. This gives you a lot of control over both groups of objects.
In the previous examples, every time we created a primitive we added it directly to the scene using the addChild() method. But not only Scene3D has this method, so does DisplayObject3D. In the documentation we can look up the path of inheritance for both classes:
DisplayObject3Dinherits fromDisplayObjectContainer3DScene3Dinherits fromSceneObject3D, which inherits fromDisplayObjectContainer3D
Both Scene3D and DisplayObject3D inherit the addChild() method from DisplayObjectContainer3D . This means that we can also use the addChild() method on...