Walking Blues

by Malefico


In this tutorial we will try to set a walkcycle and use it with the PATH option in the Blender NLA Editor.

Before starting let me say that you will need to have a basic knowledge of the animation tools, (armature set up), in order to follow the text, and have a lot of patience. It is highly recommendable to have read the precedent NLA tutorial here in this site.

We are going to use a character set up like the one explained by Lyubomir Kovachev in his "Feet" tutorial at BlenderChar, this is with feet bone split up from the leg and using an extra bone to store the IK solver constraint. For further details please check that tutorial !

If you are a lazy kind of people, you may download the sample character from here.

Walking in the air


There are two main ways to animate a walkcycle, first one is to make the character actually advance through the cycle and the second one is to make the character walk "in situ" thus without real displacement.

(these animations are property of www.idleworm.com)

The later option though is more difficult to set up, is the best choice for digital animation and it is our choice for this tutorial.

The whole walkcycle will be an "action" for our armature, so let's go an crate a new action and switch to "pose mode" to get something like Pose 1.

There are some details to bear in mind at the time of setting up an armature for walkcycle. As some of you might know, Blender uses a name convention for bones. Its names should end with a ".L" or ".left" for left bones and ".R" or ".right" for right bones. If we attend to this convention the "Paste Flip Pose" button will be available to paste the "mirror" pose of our model anytime.

To animate our walking model we will restrict to animate its feet since the IKA solvers will adjust the leg bones better than us. To ensure that feet will move in fixed distances, please activate the Grab Grid option before start moving bones, reduce the grid size if needed.

The work routine is as follows: set the model in pose 1 in frame 1, insert keyframes for the feet bones (only). Without deselecting them press the "Copy Pose" button. Now the bone's location and rotations have been stored in memory. Go a few frames forward and press "Paste Flip Pose". The flip pose will be pasted in this frame, so if in the previous frame the left leg was forward now it will be backward, and viceversa.

If at the contrary you see that the mesh is weirdly deformed, don't panic !, go Edit Mode, select all bones and press CTRL+N. This will recalculate the direction of bones rolls which is what makes the twisting effect.

Now once again select the feet bones and insert keyframes for them.

Go a few frames forward again (it is recommendable that you use the same number of frames than before) and press "Paste Pose", this will paste the initial pose ending the cycle.

This way we have achieved a "Michael Jackson" walkcycle since our character never lift its feet up from the ground. To fix it, go to some intermmediate position between the first two poses and move the feet to get something like Pose 2. Insert keyframes for the feet and copy the pose. Now go to a frame between the last two poses and insert the flip pose . Insert teh rquired keyframes and we are done. Now if you do ALT+A you will see our character moving its feet almost naturally.

It will be very useful to count how many Blender Units (B.U.) are covered with each step, which can be done counting the grid squares between both feet in Pose 1. This number is the STRIDE parameter that we are going to use later on in the NLA window (more on this in the lines below).

With feet on the ground


The animation we have achieved can be improved by adding in-between poses, this depends of your animator skills, now we will focus on make teh character actually advance through the scene.



First of all deselect the walkcycle action for our armature so it stops moving when pressing ALT +A. To do this, press the little X button besides the action name in the action window.

Then we will create a PATH object for our hero trying not to make it too curve for now (the more straight the better), once done let's parent the charcater to the path (and not the other way round). If everything went OK, we will see our charcater moving stiff along the path when pressing ALT+A.

Now go to the NLA window and add the walkcycle action in a channel as a NLA strip. With strip selected press N and then push the "Use Path" button.

Now if you do ALT+A some funny things might happen. This is due to we haven't set the STRIDE parameter.

This value is the number of B.U. that should be covered by a single walkcycle and is very important that we estimate it with accuracy. Once calculated we should enter it in the STRIDE box.

If we adjust it well and if the walkcycle was correctly set up, ourt charcater should not "slide" across the path.

One way to estimate the Stride value accurately is to count how many grid squares there are between the toes of the feet in Pose 1. This value multiplied by 2 and by the grid scale (normally 1 grid square = 1 B.U. but this could not be the case, for instance in the example 2 grid squares = 1 B.U.) will render the searched STRIDE value.

In the example there are 5 squares, since the Grid scale is 0.5 we have:

STRIDE = 5 x 0.5 x 2 = 5

Changing Speed


It's likely taht we want our character to walk faster or slower or even stop for a while. We can do all this by editing the path's Speed curve.

Select the path and open an IPO window. There we will see a Speed curve normalized between 0 and 1 in ordinates (Y axis) and going from frame 1 to the last in the X axis. The Y coordinate represents the relative position in the path and the curve's slope is the speed of the parented objects. In Edit Mode we will add two points with the same Y coordinate. This "table" represents a pause in the movement and it goes from fram 40 to frame 60 in the figure.

The problem here is that when our character stops because of the pause in the curve, we will see him in a "frozen" pose with a foot on the ground and the other in the air.

To fix this little problem we will use the NLA window. What we have to do is to insert a "still" action, this is a pose where our character is at rest. I have defined this action in only one frame by erasing all displacements and rotations of his feet. This can be done selecting both feet and pressing ALT+R (to erase rotations) and ALT+G (to erase the displacements).

We should insert this "still" action form frame 40 to frame 60 for it perfectly fits the pause. To avoid sudden transitions between poses we can add a couple of BlendIn and BlendOut frames. In this way the character will smoothly change its pose and everything will look fine.

We can of course combine different walkcycles in the same path as for instance change from walking to running in the higher speed zone.

In all these situations we will have to bear in mind that the different efects will be added from one NLA strip to the precedent strips and only them. So, the best option is to insert the walkcycle and still strips before any other.

Well this is all for now, experiment and enjoy !