Creating and Using Motion Flow Scripts
 
 
 

The Motion Flow Graph stores .bip files, referred to as clips. To create a script, you select clips that you have added to the Motion Flow Graph.

Set up the lesson:

  1. Continue from the previous lesson or load cs4_tut_moflow01.max.

    Tutorial files are in the tutorials\character_animation\motion_flow folder.

  2. If using the tutorial file, select any part of the biped and open the Motion panel.
  3. Click Show Graph to make sure the Motion Flow Graph is displayed.

Create a script:

  1. On the Motion Flow rollout, in the Scripts group, click Define Script.
  2. On the Motion Flow Graph, click the AxeKick icon first, and then the BackKick icon.

    The clip names appear in the list in the Scripts group. The name script1 displays in the text field above the list. In the Motion Flow Graph, a red transition line joins the two clips, showing that they are included in the current script. By default, Biped uses “Minimum Motion Loss” to find a likely starting frame for the transition between the source and destination clips. You have created a script called script1.

  3. Close the Motion Flow Graph window and click Play.

    Use Arc Rotate to rotate the Perspective view for a better look at the motion.

    As the animation progresses, the name of the currently-played clip appears in uppercase characters in the script list, followed by three asterisks. The numbers on the left of each clip name indicate the frame numbers where the animation starts.

    The default Minimum Motion Loss search method did not choose ideal starting frames in this case: the biped spins unnaturally during the transition. You’ll first edit the transition manually, then you’ll try an optimized transition, which uses minimum foot sliding.

Use the Transition Editor:

When you edit transitions manually, you can discard unwanted motion and adjust the duration of transitions. You can also change the direction of the destination clip in the Transition Editor.

  1. Click AxeKick in the Scripts list.

    Controls in the Scripts group are activated.

  2. Click Edit Transition.

    The Transition Editor dialog displays; the source and destination clip names appear in the title of the dialog. Position the dialog so the Perspective Viewport is visible.

  3. Click Go To Start Frame near the upper right of the Transition Editor.

    The time slider is positioned at the first frame of the transition. By default, the duration of the transition is 25 frames. This is displayed in the Length field on the upper left of the Transition Editor.

    Red and yellow stick figures (called ghosts) in the viewports help to establish a starting frame for both clips. Both stick figures display during the period of transition. Red represents the destination clip motion. The biped interpolates between the yellow and red ghosts over the course of the transition.

  4. In the dialog, set Angle to -50.

    The destination ghost changes orientation.

  5. In the Destination Clip group, set the Start to 0.

    You can choose the destination starting frame by viewing all of the clip's motion.

  6. Drag the time slider back and forth over the transition.

    In order to create a smooth transition, you’ll look for areas in the source and destination clips where foot and body movements will flow together cleanly. Frame 80, where the character’s right foot is in the air, looks like a reasonable starting frame for the source clip. Body weight is in the process of shifting to the right foot.

  7. In the Source Clip group, set the Start to 80.
  8. Move the Frame spinner in the Destination Clip Ghost group and watch the red stick figure representing the destination clip. At frame 20, the character is starting to push backward with its right foot. The character’s weight will be on the right foot in both clips if this frame is used as the Destination Start Frame.

  9. Click Set Start Frame in the Destination Clip Ghost group. The Frame value (20) is copied to the Destination Set Start Frame field; Biped recalculates and positions the destination clip.
  10. Set Length to 6 frames.
  11. Play the animation.

    The weight shifts to the right foot in both clips during the transition. The transition looks natural. Next you’ll try an optimized transition.

    TipYou can open the Extras toolbar, turn on the Keyboard Shortcut Override Toggle and press ALT+R to change the Active Time to the animation length.
  12. In the Transition Editor dialog, click Optimize Transition.

    The Transition Optimization dialog displays.

  13. On the Transition Optimization dialog, turn on Search Near Existing Transition. Click OK.
  14. Play the animation.

    The transition calculated by the automatic optimization also looks good. Optimized transitions are a time saver if there are many clips and transitions that need to be processed.

    TipYou can select multiple transitions in the Motion Flow Graph window and use Optimize Selected Transitions in the Motion Flow Graph toolbar to optimize all the transitions at once. Optimized transitions can take time to compute, but the results are worth the extra processing time.

Make the animation available outside of Motion Flow mode:

To make the animation available in your scene outside Motion Flow mode, use the Create Unified Motion command.

  1. Click OK to close the Transition Editor dialog.
  2. Click the Define Script button on the Motion Flow rollout, in the Scripts group, to turn off scripting mode.
  3. On the Motion Flow rollout, in the Scripts group, click Create Unified Motion.

    The Unify Options dialog is displayed.

  4. Click OK to accept the default settings on the Unify Options dialog.
  5. On the Biped rollout, turn off the Motion Flow Mode button.

    The motion is available as a freeform animation in your scene.

Open cs4_tut_moflow02.max to see the animation. Note that a unified motion does not contain footsteps.

Next

Looping Animation in Motion Flow Mode