After the character is bound to its skeleton, you're ready to animate with it. Because of all the built-in links and IK handles you've created, animating the character is a snap. You can simply pose the five handles (feet, hands, and waist), and IK and skinning do the rest for you. The only part you need to be careful about is "planting" the feet you need to take care to frame any time period where the foot is planted with two identical keys so that it stays put. Also, because you'll be using Trax later to make this walk cycle repeat, you need only one full step. However, you must be careful to get the character to take one full step and end up in a position identical to an earlier starting position. You need a "loopable" walk cycle! Setting up the walk cycle now to loop, or repeat itself, saves you time and energy so that you can focus on great motion for one step, instead of 30 mediocre ones during a time crunch. To make creating animation keys simpler, use Maya's Auto Key feature. This feature acts only on objects that have at least one key already, so you can designate the objects you want to animate by setting a 0 frame key as you start animating. Tutorial: Character Animation A Short Walk Now that the character is set up, you need to animate a walk cycle. As you animate, try to think of a walk as a kind of controlled fall. One leg is lifted and put forward, and then the body shifts its center of gravity forward until it topples onto the outstretched leg, freeing the other leg to swing forward. For each leg put forward, the opposite arm moves forward to give the body some counterbalance for the weight of the lifted leg. On the DVD Chapter_12\ch12tut04.wmv |
On the DVD Chapter_12\ch12tut03end.mb |
In the Range Slider, set the playback end time to 120 to allow for a longer animation. The end time pushed out to 120 automatically, which gives you 4 seconds at the default 30 fps playback rate. To make selection easier, hide the joints and IK handles and block selection of surfaces. This enables you to select only the control object cubes and rings. Choose Display | Hide | Hide Kinematics | All, and the joints and IK handles disappear. Next, set MarionetteLayer's mode to Reference by clicking twice in the center check box in the Layers dialog box (see Figure 12.16). Figure 12.16. To ease the process of selecting control objects, set MarionetteLayer as a Reference layer.
Select the control object boxes and ring for the waist, hands, and feet. Then, click and drag in the Channel Box from the Translate X, Y, and Z entries (see Figure 12.17). Right-click over the darkened entries and choose Key Selected. Now that these items have keys at frame 0, you can use Maya's Auto Key feature. To enable it, click the Key icon at the bottom right of the Maya interface; the button turns red to indicate that you're in Auto Key mode. If you move the control objects, animation keys are created. Figure 12.17. Creating keys for the Translate channels of the control objects.
Set the Time Slider to frame 10. In the Front view, bring the arms down to the character's sides. In the Side view, bring the waist ring down to add a tiny bit of crouch to the character's posture. Raise the control object boxes for the hands enough to add some natural-looking bend to the arms. Bring the waist circle slightly forward to anticipate the first step. Select all the control objects again, select the Translate channels in the Channel Box, right-click and choose Key Selected as before. With the Auto key active in the lower-right corner of the screen, this second selection and keying of all the objects a second time is redundant, but with an added keyframe, smoothing the motion later becomes easier. For the most part, you key the second time to ensure that the character doesn't jump from the bind pose into the pose starting the walk cycle. This is the starting pose, with frame 10 as a starting point, so you want keys for all control objects. Set the Time Slider to frame 20. Stay in the Side view for all the initial animation. Select LeftFoot and, in the Channel Box, set Translate X, Y, and Z to 0, 0.25, and 0.55. Next, set the Time Slider to frame 30, and select the waist and both hand controllers. Move them out to the front of the marionette a little less than one-fourth of the character's height as a general rule. The waist translates in the z-axis to 0.675, and the hands translate in the z-axis to 0.675. Now, raise the RightHand and put it slightly forward, about one hand's length. Bring the LeftHand hand slightly back. Select all control objects and, in the Channel Box, select the Translate X, Y, and Z channels again to key all. Right-click over these channels and choose Key Selected. You can scrub animation in Maya by dragging the LMB on the timeline or (the preferred method) holding down the k key while LMB-dragging anywhere in the viewport. Scrub the frames, and you'll see that you have a start. tip Remember that any animated object has some value that's being modified between two keyframes. Therefore, if you want an object to stay motionless for a time, you need to create two identical keys separated in time. Usually, you need to flatten their curves in the Graph Editor because, by default, the keys' tangents are adjusted using a spline to smooth the objects' motion. Also, the area between keys can create unexpected motion as two keys combine with a third. Because the default motion is to smoothly transition from one position to the next, curves are created to control this. At some points, as one action transitions into a very different one, the smoothing creates an action that swings the object far "off course" to try to keep the motion smooth. Set the Time Slider to frame 40. Raise the right foot's control object up about one-half the foot's length, or to Translate settings of 0, 0.314, and 1.5. Next, set the Time Slider to frame 50, and move the RightFoot to 0, 0, 2. Then, move the waist forward in the z-axis to 1.5. The hands can now be moved forward to 0.9, -0.9, 1.8 for LeftHand and 09, -0.9, 1.5 for RightHand. Now, scrub the animation and notice that RightFoot floats between frames 10 and 30. Open the Graph Editor (hotkey: Alt+g) to adjust the floating. Select RightFoot, click in the Graph Editor window, and press the f key to frame in RightFoot's keyframes. Marquee-select over the keys at frame 30 and click the Flat Tangent button on the Graph Editor toolbar. Scrub through the animation again and notice that the right foot is now stationary until it begins to step at frame 30. Next, select all the controllers and set a key for Translate X, Y, and Z. tip Be sure to always keep the knee controllers out in front of the character during the walk cycle. Should the character pass the knee controllers, the legs flip unnaturally and remain pointing at the control objects. As a good practice, animate them moving out in front of the character when the marionette turns and walks in another direction. Set the Time Slider to frame 60. Select LeftFoot and position it using the Channel Box. The Translate settings should be at 0, 0.345, and 2.361, leaving the foot hanging in midstride. Next, set the Time Slider to frame 70. Select the waist and both hands, and bring them forward to a point beyond where LeftFoot is planted, and the waist and hands are making their way into the next step. The Waist Translate Z setting should now be at 2.5. The LeftHand will be at 2.8 in the z-axis, and the RightHand will be at 2.5 in z-axis. This brings the LeftHand up in front to offset the RightFoot, and the LeftHand swings back behind the torso at this point. You might notice several more areas where the feet seem to float as you progress through the walk cycle. Look for these areas where each foot should be planted as the other foot steps. Select LeftFoot and, in the Graph Editor, apply a flat tangent to the keys from frame 30 to 50 (see Figure 12.18). Figure 12.18. Editing keys in the Graph Editor.
Scrub the Time Slider again. The left foot now travels properly. Now add another step to the walk cycle. Go to frame 80, select RightFoot, and change its Translate settings to 0, 0.5, and 3.2. Move to frame 90 in the Time Slider, select the Waist, move it in the z-axis to 3.4, and move RightFoot to 4 in the z-axis. Next, move the RightHand to 3.3 and the LeftHand to 3.6 in the z-axis. Select all control objects and, in the Channel Box, set a key for Translate X, Y, and Z. As a last step in the walk cycle, clean up any areas you haven't fixed yet. Select RightFoot first and open the Graph Editor (hotkey: Alt+g). Press the f key again to frame the keys in your view. Marquee-select the keys at 50 and at 70 and apply a flat tangent to smooth the motion into and out of the footstep while keeping the RightFoot planted in between. To the left side of the Graph Editor, you see the object name (RightFoot) and the keyed Translate Z. Click on Translate Z to the left and on the graph; only the blue curve representing the movement in the z-axis is displayed. Notice the extra keys at frame 40 and 80. Select these two keys on the blue curve and delete them. Select LeftFoot and press the f key to focus in the Graph Editor. A curve dips below the 0 value just before frame 10. Select the keys at frame 10 by pulling a selection window over just that area. Click the Flat Tangent button to flatten out this area of motion. Next, select the keys at frames 70 and 90 and click the Flat Tangent button. Now, scrub the Time Slider, and you should have a smooth easing into each step and each foot will be planted between steps. The other control objects don't have to be modified, so you're almost done. Before you end the walk cycle, scrub through the animation; you might notice that the marionette seems a bit bowlegged in the Perspective view. Because you didn't animate any motion in the Translate x-axis, you can select RightFoot in the Graph Editor and then select only the Translate X entry at the left of the Graph Editor. Press the f key to focus, and check whether all the keys are the same value. To do this, select the key, and its value is displayed in the upper Stats window. Pull a marquee window over all keys in the x-axis and delete them to break the connections. Because the character's legs seem to be positioned strangely, set Translate X for RightFoot to 0.15. Then, select LeftFoot and repeat the same steps you used for RightFoot. Delete the keys in Translate X, and in the Channel Box, enter -0.15 for the Translate X setting. Now that you're done animating, switch off Auto Key mode. Otherwise, you might inadvertently create new animation, particularly when scrubbing the Time Slider and adjusting the position of objects in the scene. It's a good idea to be aware of when you've engaged Auto Key; then, create your animation and exit Auto Key mode. Compare your results to Figure 12.19. Figure 12.19. Walking at last. With minimal keyframing, you created a couple of footsteps from the starting neutral pose at frame 10. With a loop of animation occurring between frames 30 and 70, you can use Maya's Trax feature to repeat the walk for you automatically.
|