Introducing Maya 6: 3D for Beginners | 5 | WebReference

# Introducing Maya 6: 3D for Beginners | 5

### Creating the Animation

To begin this phase of the project, load the file Planets_v2.mb in the Scenes folder of the Solar_System project on the CD, or continue with your own scene file. The animation you'll be doing for the orbits is straightforward. Basically you will rotate the planets around their own axes, then you'll animate the moons around the planets, and finally you'll send the planets with their moons orbiting the sun.

The premise of this exercise deals with hierarchy and pivot points. A pivot point is an object's center of balance of sorts. Every object or node that is created in Maya has a pivot point at its origin. Since most objects, such as the spheres you created for the planets, will appear at the origin upon creation, their pivot points are automatically centered.

Once you move an object, as you have done to position the planets and moons, the pivot point moves with it. Thus, all your planets' and moons' pivot points are already correctly positioned at the center of each planet and moon.

Now you'll set up your scene file's animation settings:

1. Press F2 to open the Animation menu set.

2. With the Range Slider, set your animation to go from 1 to 240.

3. Click the Animation Preferences icon ( ), click Settings, and set Time to 30 frames per second, or NTSC video speed.

4. Verify that Up-Axis is set to Y and not Z. This ensures that you have designated the Y axis to be pointing "up" in the perspective window or pointing out at you from the monitor in the top view. "Y up," as it's called, is Maya's default, but it never hurts to make sure.

 Choose Window > Settings/Preferences > Preferences to open the Preferences window. Under Settings: Undo, check the circle for Undo to On (if it isn't already), and set the Queue to Infinite. Setting the Queue to Infinite takes a little more system memory, but it's worth it. With this configuration, you can undo (press Ctrl+Z or just Z) as many times as it takes to undo any blunders. To close the Preferences window, click Save.

### Mercury's Rotation

Now you're ready to animate Mercury's rotation. Follow these steps: 1. Select Mercury first, and press E to activate the rotation manipulator. Press F to focus on it in the perspective view, or zoom in on it manually.

2. Make sure you are on frame 1 of your animation range. You'll place an initial keyframe here for the first planet.

3. For Mercury, you'll be setting your initial keyframe for the Y-axis rotation. In the Channel Box, click the attribute Rotate Y to select it and choose Animate > Set Key. The Rotate Y's attribute box should turn orange, indicating a keyframe or other input if you have followed the advice in the sidebar "Setting Keyframes." If you have left it at its defaults, Animate > Set Key will set keys on all the attributes, turning them all orange.

4. With the Range Slider, go to frame 240. Grab the rotation manipulator handle by the Y axis and turn it clockwise a few times to rotate the sphere.

5. Choose Animate > Set Key with the Rotate Y attribute still selected in the Channel Box.

6. To playback your animation, you can scrub your Timeline. Scrubbing refers to using the mouse to move the time marker back and forth to watch the animation playback in a window. Click in the Timeline, hold down the left mouse button, and move your cursor side to side to scrub in real time. You'll see Mercury rotating around itself in your active view panel.

Clicking so many things just to set two keyframes may seem like a lot of work, but you're doing this the long way right now; you're not yet using any shortcuts or hot keys. You'll start using those for the next planet.

You have the self-rotation for Mercury worked out, and since there's no moon for Mercury, let's get it orbiting the sun.

### Grouping Mercury for a New Pivot Point

You've learned that every object created in Maya is created with a pivot point around which it rotates, from which or to which it scales, and which acts as the placement point for its XYZ coordinates. If the pivot point for Mercury is already at the center of itself, how can you rotate it around the sun?

One idea is to move its current pivot point from the center of itself to the center of the sun. That would, however, negate its own rotation, and it will no longer spin around its own center; so you can't do that. What you need to do is to create a new pivot point for this object by creating a new parent node above it in the hierarchy. For more on object nodes and hierarchy, refer to the end of Chapter 2.

To create a new pivot point, follow these steps:

1. With Mercury still selected, choose Edit > Group. The Channel Box displays the attributes for the node called group1. In addition, the rotation manipulator handle jumps from where it was originally, centered on Mercury, to the origin.where the zero points of the X, Y, and Z axes collide. Figure 3.12 shows the new Mercury group and its new pivot location.

You essentially created a new Maya object by grouping Mercury to itself, and hence also created a new pivot point, placed by Maya at the origin by default. Since an objectÂ¡Â¯s manipulator always centers on its pivot point, yours jumped to the origin. That's fortunate for you, because that just happens to be the center of the sun, exactly where you need it to be for Mercury to orbit it properly.

Figure 3.12 Grouping Mercury to itself creates a new pivot point at the origin.

2. Without unselecting Mercury, click the word group1 in the Channel Box and change the name of this new group to Mercury_Orbit.

3. Now click anywhere in an empty space in your view window to unselect Mercury_Orbit. Try selecting it again. Notice that when you click Mercury, you only select the planet and not the new parent node Mercury_Orbit, the group that has its pivot point at the center of the sun. This happens because you are in object selection mode.

 To select the group Mercury_Orbit, you need to switch into Hierarchy Mode by toggling icon ( ) on the Status line. Just remember to switch back to Object Mode ( ).

4. Go back to frame 1 of your animation and set a keyframe for Mercury_Orbit's Rotate Y attribute by choosing Animate > Set Key.

5. Go to frame 240, grab Mercury_Orbit's rotate manipulator handle by the Y axis, and spin it around the sun twice. You could also type 720 in the Rotate Y attribute field in the Channel Box.

6. Choose Animate > Set Key to set a keyframe at frame 240 for Mercury_Orbit. Scrub your animation to play it back.

One down, eight to go.

### Creating Venus

For your next planet, Venus, follow the same procedure as for Mercury, and animate it so that it orbits itself. Then create a new pivot point by grouping it to itself (and calling the new node Venus_Orbit). Last, animate Venus_Orbit to rotate around the sun.

### Earth and the Moon

You will animate the third planet in much the same way, except that this time there is the added complication of a moon. In addition, instead of choosing Animate > Set Key to set your keyframes, you'll use the keyboard hot key S.

 Whenever you press S and an attribute is highlighted in the Channel Box, you are essentially choosing Animate > Set Key. Make sure in the Set Key Options dialog box that you have changed Set Keys On to All Keyable Attributes instead of the default All Manipulator Handles and Keyable Attributes and that you've set Channels to From Channel Box instead of the default All Keyable.

To animate Earth and the moon, follow these steps:

1. Select Earth and give it its self-rotation animation as with Mercury, but this time select the rotation channels in the Channel Box and press S instead of choosing Animate > Set Key for rotation keyframes. Again, if you have left the Animate > Set Key q at its defaults, pressing S will set keys for all attributes, but if you followed the advice given previously, only the channels will be keyframed.

2. Select the moon and give it its own self-rotation animation by spinning it around itself and keyframing it as you've just done with Earth.

3. To spin the moon around Earth, do what you did earlier in this chapter to spin a planet around the sun. Group the moon to itself by choosing Edit > Group and name it Moon_Orbit.

This time, however, you need the pivot point to be at the center of Earth and not at the center of the sun, where it is currently. Follow these steps:

1. Turn on the grid snap, and then press the Insert key to activate the pivot point. The moon's manipulator changes from a rotation handle to the pivot point manipulator. This manipulator acts just like the move manipulator, but instead of moving the object, it moves the object's pivot point.

2. Grab the yellow circle in the middle of the manipulator and move the pivot point to snap it to the grid point located at the center of Earth (see Figure 3.13).

3. Press the Insert key again to return to the rotation manipulator for Moon_Orbit. At frame 1, set a keyframe for the moon's Y-axis rotation. Then, at frame 240, rotate the moon about the Y axis and set a keyframe. Return to frame 1.

Figure 3.13 Moving the moon's pivot point to the center of Earth

 [previous] [next]

Created: March 27 2003
Revised: November 1, 2004

URL: http://webreference.com/graphics/maya_6/1