Grouping vs. Parenting


The difference between parenting and grouping is subtle. Both actions create a hierarchy that lets you move grouped objects. In some respects, grouping is like parenting several objects to an object that contains no geometry (know as a null object, or null). However, you must note a few differences.

When an object becomes a child of another object, it uses its parent as its new world space. That means it no longer looks to the center of your scene to get its position information; instead, it looks to its parent. An object under a group still uses the scene's world space (Figure 6.26).

Figure 6.26. On top, the cubes are grouped, and pCube2 is two units over and one unit up. When pCube2 is parented to pCube1 (bottom), the translation values change because pCube2 is only one unit to the right of its parent. The position of the cube hasn't changed, but its transformation values have.


The parent-child relationship is also used in some elements of Maya to establish how objects are connected. This functionality is especially important in bones (as discussed in Chapter 10). When parented together, bones become connected in a special way that allows them to function like a real skeleton (Figure 6.27).

Figure 6.27. The top group of joints is parented together, so the joints appear to be connected. The bottom set of joints has been grouped to behave similarly, but the joints lack the same connections.


Grouping can do just the opposite: It severs links or the inheriting of information you may not want. For instance, if an object is scaled, all its children are in a scaled world space. This can create odd distortion with rotations. By using groups, you can establish more control over the attributes of your world space, including pivot point, scale, and rotation.

Building a lamp out of objects is a good example to show this contrast.

To build a lamp using parenting:

1.

Choose Create > Polygon Primitives > Cone, and enter the settings shown in Figure 6.28.

Figure 6.28. This cone will form the base of the lamp.


2.

Create two poly cylinders, scale them to be long and skinny, and position them on top of each other above the cone.

3.

Duplicate the bottom cone, and position it on top of the cylinders like a shade (Figure 6.29).

Figure 6.29. A simple lamp arrangement. It needs some structure to allow you to move it.


4.

Choose Window > Outliner.

In the resulting view of your objects, you can see that they have no grouping (Figure 6.30).

Figure 6.30. The objects aren't grouped.


5.

In the Outliner, use the middle mouse button to drag pCone2 onto pCylinder2, pCylinder2 onto pCylinder1, and pCylinder1 onto pCone1, creating the structure shown in Figure 6.31.

Figure 6.31. Drag and drop each piece onto the next until the structure looks like this.


Now the lamp's parts are parented together so that each piece is moved by those below it, like a real lamp.

6.

Select pCone1, and rotate it.

The whole lamp moves, because the rest of the pieces are children of the base.

7.

Select pCylinder1, and rotate it.

The lamp becomes distorted (Figure 6.32) because the rest of the lamp is a child of the cone and inherits the cone's scale values.

Figure 6.32. This unwanted distortion occurs because the objects inherit scale values from their parents.


You can avoid distortion problems by freezing the transformations and setting new pivot points on the object, or by using grouping instead. Using groups gives you an extra level of control as well. To illustrate the difference between the two, let's opt for grouping.

To build a lamp using grouping:

1.

Perform steps 14 of the previous task to create the base lamp with no hierarchy.

2.

Select the shade and top arm of the lamp, and group them by pressing or choosing Edit > Group.

3.

Press to get into pivot point mode.

You can now access group1's pivot point, which is at the bend of the lamp.

4.

Select the Move tool, and position the pivot point at the joint of the lamp (Figure 6.33).

Figure 6.33. Drag the pivot point down to the middle joint. This is the point at which the lamp will bend.


5.

With group1 still selected, +select the lower arm of the lamp and group the parts by pressing or selecting Edit > Group.

This action creates a nested group consisting of group1 and the lower cylinder (Figure 6.34).

Figure 6.34. A grouped hierarchy is nested differently than a parented hierarchy.


6.

Position the pivot point of group2 at the base of the cylinder (Figure 6.35).

Figure 6.35. Drag the new pivot point down for the base joint.


7.

Select the Rotate tool, and rotate group2.

The entire top of the lamp pivots and moves with the group, and there is no distortion. You can now position your lamp as you desire (Figure 6.36).

Figure 6.36. As long as you select the group nodes, you can pose the lamp without distortion.


Freeze Transformations

When you're parenting, it isn't always desirable to have children inherit certain transformations from their parents. For example, an object may become skewed if it's parented to an object with scale transformations. Alternatively, you'll often want to create a way to easily return an object to its original position. Freeze Transformations is a handy tool that helps in both these situations.

Freeze Transformations (available in the Modify menu) resets the transformation values of an object to zero without moving the object. Think of it as establishing a new origin for the object. The most obvious result is that you can easily "zero out" an object (return it to its original position). Using Freeze Transformations also sets scale values to 1, so it avoids distortion in parenting chains.

It's a good idea to perform Freeze Transformations on an object once you've placed it where you need it. Doing so simplifies your scene and makes performing actions on multiple objects easier. Animation controls with logical default positions are simpler to keep track of. As a result, animating with the object is much easier, because you can tell how far the object has moved relative to its starting location instead of looking at random numbers.





Maya 7 for Windows and Macintosh(c) Visual Quickstart Guide
Maya 7 for Windows & Macintosh
ISBN: 0321348990
EAN: 2147483647
Year: 2006
Pages: 185

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net