1. INTRODUCTION
1.2 Mouse limb development: a model system for patterning and morphogenesis
In this example, we'll combine the mocap that we already have with keyframing, using the simplified hybrid setup you've been using from the CD. The model will walk along and inad-vertently stumble over a box. Since the mocap does not include her tripping, we must keyframe this motion on the animation skeleton, blending it with the mocap skeleton's motion.
This particular skeleton has only basic animation controls for purposes of demonstration. A production skeleton should have several more options such as forward kinematic controls on the arms and legs, as well as inverse kinematic controls.
Let's get started. Follow these steps:
1. Load the file O f f s e t . m b that you created earlier in this chapter and source the script S n a p . m e l .
To source the MEL script, open the Script Editor, and choose File Source Script. Browse to the location of the S n a p . m e l script on the CD. Select it, and click Open.
2. At the command line, type snap to open a box that has a Snap Skeleton button and a Reset button, as shown in Fig-ure 4.23.
Make a Snap Button
To make things easier later, let's make a button for the Snap tool.
This tool is a MEL script that will help us get the animation model into position at the point where the transition from mocap to keyframed animation occurs. Follow these steps:
Figure 4.23: The Snap but-ton is activated.
1. In the input area of the Script Editor, type snap, highlight the word, and drag it to the shelf.
2. In the main menu, choose Window Settings/Preferences Shelves.
3. Scroll down the list to find the Snap tool, and in the box next to Icon Name, type snap, and press Enter.
4. Save all shelves and close the dialog box.
Figure 4.24: The model with foot controls selected
Make a Button for Selecting Animation Controls
Now let's make a button to select the animation controls on the animation skeleton. Start by hiding the layers for the parts of the model that we don't need at the moment. Make sure that the visibility is off for the bindSkeleton, the mocapSkeleton, the offsetSkeleton, and the offsetControls. Follow these steps:
1. In the Show menu in your Scene Menu bar, turn offJoints, IK handles, and Locators.
2. Select the two large boxes that represent the foot controls, leaving the other boxes and controls on the feet unselected, as shown in Figure 4.24.
3. Add to the current selection by holding down Shift and dragging over the remaining boxes and curve controls that are visible above the feet.
Leave the large Control box cube next to the model unselected.
Make a Button to Select Animation Controls
Now we'll create a button to make the animation controls easier to select. Follow these steps:
1. In the Script Editor, highlight the output that describes the selection you just made.
Make sure the two large boxes of the feet are included in the list of objects selected.
Use this text:
2. Choose File Save Selected to Shelf, and enter a name such as SELECT.
3. Click an empty space in your workspace to deselect everything.
Now, let's bring back some of the layers you've hidden, such as the bindSkeleton and the mocapSkeleton. You can use the offset skeleton and offset controls as well later, if you like, but for now, let's keep them hidden to reduce screen clutter.
Let's start animating. Select the Control box, and key the Mocap_keyframe attribute in the Channel box to a value of 0.
Summary 11 7
Put the bindSkeleton layer in reference mode. This will make it easier to select the animation Control boxes.
Determine Where Mocap End and Keyframing Should Begin
Now, let's assume that we want the model to stumble over a box at frame 113, since that's where she is shifting weight for the next step. Follow these steps:
1. To create the box, choose Create Polygon Primitives Cube In the dialog box, type the dimensions of the box, maybe along the lines of a width of 1.5 and height and depth of 0.3. Place the box in front of the model's feet, near the tip of her left toe. As you scrub through the Timeline, you notice the model's feet go through the box at frame 115.
2. Let's place another key on the Control box at frame 112, at a value of 0. At frame 113, key the Control box again, only with a value of 1. This creates the transition of influ-ence from the mocap skeleton to the keyframe animation skeleton. The bind skeleton follows whichever skeleton is keyed to the on position, meaning having a value of 1.
The model will snap to the exact position of the animation skeleton in the work space.
3. View your curve in the Graph Editor, and ensure that the first two keys have flat tan-gents. At this point if you scrub forward, you'll see the body of the model float back-ward to its initial position, which happens because the influence of the animation skeleton is on at that point, and the influence of the mocap skeleton is off.
4. To help get the body into the position of the last frame of mocap used before the transi-tion, we'll use the Snap tool. Scrub back to frame 114, and ensure that the mocap skele-ton is visible in the Layer Editor. Make sure that Joints are turned on under Show in your working view as well. Click the Snap button you made earlier. The bind skeleton and the animation skeleton should both snap to the position of the mocap skeleton. Click the Select button. Set a key by pressing s on your keyboard. The Snap tool is designed to be used only once at the transition point between motion capture and animation.
5. Keyframe the rest of the animation as you would a regular animation skeleton.
Summary
In this chapter, we covered the basics of motion capture and discussed methods of working with it. We manipulate the mocap using offsets and the Trax Editor, as well as by adding keyframes to a hybrid animation model to blend traditional key framing with motion cap-ture. You can combine animation and motion capture in many ways, so have fun exploring
and try different solutions.