Animating with Keyframes

You can think of keyframes as the beginning and ending points of an animation. You can break down all motions into a series of simple motions that can be represented by keyframes. For example, think of a character jumping to dodge a swinging ninja's sword. The beginning pose has the character crouching ready to jump, and the end pose has the character raised up off the ground (and hopefully away from the attacking ninja's sword) with legs extended.

If you know these two character positions, you simply need to define and set a keyframe for each pose and define the number of frames in between, which is the time that it takes the character to complete the motion. With these two positions defined, Max is smart enough to figure out all the positions in between these two end positions and voila, animation.

For many simple character animations, such as a waiting cycle or a ready-to-fight sequence, keyframe animation is easy to use. If you create keyframes from one pose to another and then another keyframe that returns the character to the first pose, you can loop the animation sequence to create a seamless motion.

1. Select the Hicks character and move and rotate his bones to create an initial pose (see Figure 8.1). This pose is a simple standing-still pose.

2. The time slider is already set on frame 1 by default. Open the Select by Name dialog box and select the entire biped structure. You need to select the biped structure because the keys are set for the bones and not for the mesh skin. The bones control the skin, so you need to apply the keys to the bones.

3. Click the Auto Key button at the bottom of the interface. This button automatically records keys for all changes made to a character for the given frame. Then select and move the Hicks character up and back down to the same spot to set a key for frame 1. You can see the key mark in the time slider when you set a key.

Figure 8.1 The Hicks character is standing still waiting for some action.

4. Drag the time slider to frame 10. Then move and rotate the bones to create a secondary pose (see Figure 8.2). The new key is added automatically after you move the bones.

Caution

Be careful when using Auto Key, because it sets a key for all changes, including changes to the interface. If you're not sure if Auto Key will record changes, turn it off before you make the change.

5. Drag the time slider back and forth between frame 1 and frame 10 to see the resulting motion. Pretty cool, eh? And easy to do. Keyframe animations are great for simple motions, but they can quickly become overworked for complex motions.

6. Reselect all the biped objects, and with the Shift key held down, drag the gray key on the time slider at frame 1 to frame 20. This copies the first key to frame 20. Now if you drag the time slider between frames 1 to 20, the character moves into its fighting pose and then back to its waiting pose. This animation loop helps prevent skips or jumps in the animation.

Figure 8.2

The Hicks character is now ready for some action.

Figure 8.2

The Hicks character is now ready for some action.

7. Before moving on, save the animation sequence using the File, Save Animation menu. This opens the Save XML Animation File dialog box, where you can save the animation sequence (see Figure 8.3). Be sure to save only frames 1 through 20. You should also save the Max file because some game engines require that animation sequences are loaded as Max files. Saving the animation

Figure 8.3 The Save XML Animation File dialog box lets you save animation sequences where you can recall them at a later time.

sequence separate from the Max files lets you revisit and blend the animation at a later time or apply the animation to another character.

Now that you have a "ready to fight" animation sequence, you'll want to create several more animation sequences, including one for ducking, dodging, and firing a weapon. There should be a separate animated sequence for each action that the game player can do.

Figure 8.3 The Save XML Animation File dialog box lets you save animation sequences where you can recall them at a later time.

1. With the "ready to fight" animation sequence still open, drag the time slider to frame 1 and choose the Character, Set Skin Pose menu. This defines the standing pose as the default pose. You can recall this default pose at any time using the Character, Assume Skin Pose menu.

2. Drag the time slider to frame 10, click the Auto Key button, and move the biped bones to position Hicks in a firing position by rotating his head, positioning his arms, and setting him in a sideways stance (see Figure 8.4).

3. Drag the time slider to frame 20 and select the Character, Assume Skin Pose menu. This causes the character to return to his default pose. Because the default pose at frame 1 is the same as the one at frame 20, the animation sequence loops between the two poses.

4. Save the file as HICKS-keyframe-firing.max, and save the animation sequence using the File, Save Animation menu.

Figure 8.4

The Hicks character in a firing position, allowing space for his weapon.

Figure 8.4

The Hicks character in a firing position, allowing space for his weapon.

Before moving on to walk and run cycles, we'll create one more standing animation sequence for having the character duck to avoid a shot. We can create this sequence using the same steps that we used previously for the firing stance.

1. With the "firing" animation sequence still open, drag the time slider to frame 1 and choose the Character, Assume

Skin Pose menu. This sets the first frame of the character sequence.

Note

When the Character, Assume Skin Pose menu is selected, only the selected bones are returned to the set skin pose. To return the entire character to the default skin pose, select all the bones in the biped. You can also select to return only a single bone to its default.

2. Drag the time slider to frame 10, click the Auto Key button, and move the biped bones to position Hicks in a dodging position by rotating his legs and arms and moving the entire biped downward (see Figure 8.5).

Figure 8.5

The Hicks character in a dodging position.

Figure 8.5

The Hicks character in a dodging position.

3. Drag the time slider to frame 20, and select the Character, Assume Skin Pose menu. This causes Hicks to return to his default pose. Because the default pose at frame 1 is the same as the one at frame 20, the animation sequence loops between the two poses.

4. Save the file as HICKS-keyframe-dodge.max, and save the animation sequence using the File, Save Animation menu.

0 0

Post a comment