Director 3D > Cloning and Grouping

Parents and Children

Typically a 3D world hierarchy would look something like this:

Every node is a child of the world and every nodes parent is the “3D World” group. Consider the following hockwave 3D example. The two 3D models you see here (the sphere and the monument) are both "children" of the 3D world. They are both child nodes - their parent is the "3D World" group.

Note that the monument's rotation has no effect on the sphere. Both models are doing their own thing.

You can download the source file here (right click and choose Save Target As).

Using a parent/child grouping allows us to create a logical hierarchy of 3D nodes:

Each child node is part of a group belonging to its parent. Consider the following example. Again, this is a mounment and a sphere. However this time the sphere is a CHILD of the monument (like the Wheels are a child of the car in the diagram above).

Notice that the same rotation command applied to the monument now rotates both the sphere and monument as one? This is because any tranformation applied to the monument (as the PARENT model) also applies to the sphere. Additional transformations (e.g. rotation) could be made to the sphere itself, which would NOT affect the monument. This is the piece of script that identifies a model as a "child":

pModel.addchild(pSphere) --make the sphere a child of the 3D model

You can download the source file here (right click and choose Save Target As).

There is no hard limit to the amount of children a node can have (apart from memory and processing speed), however a model cannot have more than one parent.

< Previous | Next >

July 2003