Run, Forrest! (in cycles)

Whether you're animating for a game or film, you're likely to face the need to create cycled animations, and that is especially true for the former.

Run and walk cycles are normally created in two ways: the character may stay in a fixed position, while his feet "slide" on the ground with its positioning set at a later stage; or the character really makes two steps forward, while Blender takes care of appending the beginning of the next cycle where the first ended—making the character really move forward in a straight line. The latter is what we'll cover here.

How to do it...

  1. Open the file 008-RunCycle.blend. It has our character Otto in its resting pose, ready for our work. We're going to create a funny jog run cycle. When the term "cycle" is used in animation, it means the last position of the action must be equal to its first one. This ensures that it can be repeated indefinitely in a seamless manner.
  2. First let's create the Extreme positions of this run cycle. We can set them as frames where the character's body is on one foot, with the supporting leg flexed a bit in order to transition to the next step. This way, we'll have two different Extreme positions here: one for the right leg and one for the left. The third Extreme should be where our second cycle begins, so the difference between this and the first is only the position on the Y axis. For this funny run cycle, an animated sequence by the renowned animator Richard Williams was used as reference. The next screenshot shows our Extreme positions set:
    How to do it...
  3. In order to create the second Extreme position, you can use the mirrored first pose as the base. To do that, go to the frame where you've set the first Extreme, select all the bones from the character's body (not the switcher ones, such as IK-FK, nor the Root bone), press Ctrl + C, go up 10 frames (Up arrow), and press Ctrl + Shift + C. This will copy the first pose and paste it mirrored on the selected frame in the timeline.

    Note

    For the cycle action, you shouldn't add keyframes for the Root bone. We're going to use it to make the cycle move forward later, so it shouldn't have any keyframes set or we could end up with unexpected results.

  4. You'll notice that the character remains on its Y axis position, so you need to select the bones Foot.R, Foot.L, and Hips, and then move (G) them to the front until you think it's is a good distance for the second step. With all bones selected, insert a new keyframe (I) to save this position.

    Note

    Since nobody walks on mirrored steps, use this mirrored pose only as a base for your work. Make it slightly different so the character's motion looks natural.

  5. The third Extreme needs to be an exact copy of the first, so you can go to the first pose, select all the character's bones and copy the pose with Ctrl + C. Then you go up 20 frames (since the second step is at frame 11) and paste the pose with Ctrl + V. Now you just need to move the character on the Y axis, using the same three bones we used to create the second Extreme, and insert a new keyframe for this pose.
  6. After you're satisfied with your Extreme poses, mark them as such on the DopeSheet window by selecting them all (A), pressing (R), and selecting Extreme on the pop-up menu.
  7. On the DopeSheet window, make sure the Summary is enabled and make a quick Timing adjustment by moving the summary diamonds on the timeline (hold Ctrl to snap them to the exact frames). Press Alt + A to watch it or make a playblast using the OpenGL render preview.

    When you're happy with the timing, start creating the Breakdown positions. In this jog run action, the Breakdown happens when both feet are off the ground, in the middle of the step.

  8. Move the character's torso up, leaving the supporting foot from the first Extreme behind his body on the air and the other foot up in front, in preparation for the next step. The second Breakdown can be created by using a mirrored copy from the first Breakdown as a starting point, just as you did with the Extreme positions. The next screenshot shows the five positions (three Extremes and two Breakdowns superimposed):
    How to do it...
  9. After adding the Breakdowns, add the remaining poses: notably the one where the foot loses contact with the ground and the one where it touches it again with the heel. The next screenshot shows all poses from this cycle superimposed:
    How to do it...

    Now our first part is done. We have defined the cycle, but how can we make it really loop while going forward? This is where we're going to use the Root bone and the NLA Editor.

  10. Still in the DopeSheet window, change the window mode to Action Editor and define the name of this action as Cycle. Make sure the Root bone doesn't have any keyframes set on this action.

    Note

    The Root bone is the parent of all bone chains on the rig, so moving it makes everything move along.

  11. Once you set the name of the cycle action, click on the plus (+) sign next to its name to create a new action. Define its name as Stride.
  12. In the 3D View, go to frame 1 (or the first frame of your cycle action), select the Root bone and insert a LocRot keyframe (I) for it. We need to position the Root bone forward on the exact same timing and spacing it takes from the first Extreme of the cycle to the last. But how do you know exactly how much you need to move the Root bone forward? Using the Transform panel on the 3D View!
  13. Still in the first frame, enable the Transform panel on the 3D View (N), select the Foot.R bone (which is planted on the ground), and check its Y location value. In this case the value is 0, as you can see in the following screenshot:
    How to do it...
  14. Now, navigate through the timeline until the last position of the cycle, on the third Extreme. Look at the value of the Y location for that bone again. In this case, it's 7.668. This is how much we need to move the Root bone forward, on its Y axis. The math for this is the last position minus the first one.
  15. Go to the last frame of your cycle and move the Root bone forward to the position you've got at the previous step. You may accomplish it through the Transform panel, typing the value on the Y field and inserting a new keyframe (I) for it.
  16. Now, with the Root bone still selected, open a Graph Editor window and look to its Y Location curve. We need to turn it from a soft curve to a step where the bone "jumps" from one position to the other directly. We also need to repeat this movement in an incremental way: the Root bone should go forward more steps in order to allow more repetitions of this cycle.
  17. With its Y Location channel selected, go to the Key menu at the header and choose Interpolation Mode | Constant. This will make the Root bone "jump" from one position to the other directly, without inbetweens.

    Note

    Another good way of accomplishing this non-interpolated motion is through the Stepped F-Curve modifier, adjusting the Step Size and Offset according to the Timing of your cycle.

  18. Once you set this stepped motion for the Root bone, let's make it repeat incrementally. With the Y Location channel still selected, open the Properties (N) panel on the Graph Editor window and look for the Modifiers section. Click on the Add Modifier button and choose the Cycles modifier. Leave the Before values unchanged. For the After values, set Repeat with Offset on the first field and the number of cycles you need on the After Cycles field. Your curve and modifier values should look similar to what's shown in the next screenshot:
    How to do it...

    We're almost done. Now we have two actions: one with the weird jog run cycle animation and the other with the Root bone "steps", to move the cycle forward. It's time to do some NLA magic!

  19. Open a NLA Editor window. On its left-hand side panel it should have your currently open active Action highlighted in red, which should be Stride. Click on the snowflake icon next to its name to turn into a NLA Action Strip.

    On the Properties (N) panel to the right-hand side, set this new track name as Stride on the Active Track section. Scroll down the panel and look for the Action Clip section. The End Frame field has the number of frames of the Action, but it doesn't consider the cycle modifier we've set, so we need to multiply this value by the number of cycles we need.

  20. In a DopeSheet window, open the Cycle action. Back to the NLA Editor window, you'll notice this action is now highlighted in red as the active action. Click on the snowflake icon to turn it into another NLA Strip and set its name as Cycle on the Active Track section. You'll see both actions layered on the NLA timeline, as seen in the next screenshot:
    How to do it...
  21. Scroll down the Properties panel and look for the Action Clip section for the Cycle action. On the Playback Settings values, change the Repeat field to the number of cycles you need.

    Note

    The number of cycles for the run cycle here is one unit higher than the number of cycles set on the Stride modifier. For example, if the stride moves forward four times, the cycled run must repeat five times. It happens because the stride controls the starting point of the cycle, so the fourth stride jump is actually the beginning of the fifth run cycle.

    Almost done! If you hit Alt + A to play the animation, you'll notice that there is a weird jump between each cycle. It happens because we need to remove the last frame of the Cycle action from the NLA evaluation, since it overlaps with the first frame of the next cycle.

  22. Back to the Action Clip section on the NLA window, with the Cycle strip still selected, just reduce the value set on the End Frame field by 1 and you're done. Now the playback (and your character) should run just as expected.

Note

If you need to edit the contents of an Action Strip inside the NLA, just select it and press Tab, just like you do to enter the Edit Mode of objects on the 3D View. You'll enter on some kind of Edit Mode for actions, and you'll be able to tweak the keyframes inside the DopeSheet window.

The file 009-RunCycle-complete.blend has this finished recipe for your reference.

How it works...

By carefully building a cyclic run, where the first frame equals its last, you can use the NLA Editor and the Root bone to repeat the cycle as you wish. The Root bone, which is the parent of all bones in the armature, should move forward the exact length of the cycle without any interpolation between its first and last position. The length of the entire run can be controlled through F-Curve modifiers and the NLA strips.

See also

Appendix: Extremes, Breakdowns, Inbetweens, ones and twos

Chapter 6: Non-linear animation

Chapter 6: Animating in layers

Chapter 7: Easy to Say, Hard to Do: Mastering the Basics

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.83.96