by Claudio 'Malefico' Andaur
Relevant to Blender v2.31
In this tutorial we will set up a walkcycle and use it
Path option in the Blender NLA Editor. Before starting let
me tell you 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 recommended that you read
all the preceding NLA related parts of this Book.
We are going to use a character set up like the one explained in the “Hand and Foot Rigging tutorial”, that is with foot bones split up from the leg and using an extra null bone to store the IK solver constraint. For further details please check that section!
Having a rigged character, the first thing we need to do is to define actions: “WALKCYCLE”, “WAVE_HAND” and “STAND_STILL”. In WALKCYCLE and STAND_STILL there will be KeyFrames set for almost all control bones while in “WAVE_HAND” there are KeyFrames only for the arm and hand. This will allow our character to simultaneously wave its hand while walking.
The main idea behind this is to work on each single movement and later on combining everything in the NLA window.
There are two main ways to animate a walkcycle, first one is to make the character actually advance through the poses of the cycle and the second one is to make the character walk in place thus without real displacement.
The latter option, though 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 create a new action and switch to "pose mode" to get something like Pose 1 (the so called “contact pose” in Figure 16.71, “Some common poses in a walkcycle.”.
There are some details to bear in mind at the time of setting up an armature for walkcycle. If we adopt Blender's naming convention introduced in the section called “The Armature Object” you will be able to paste flipped poses. Also, before parenting your armature to your model, be sure their local axis are aligned to the global axis by selecting them and pressing CTRL-SHIFT-A.
To animate our walking model we will restrict us to animate a
few control bones. In the case of the legs we are going 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
Grab Grid option in the User Preferences Window
View and Controls buttons before start moving bones, reduce the
grid size if needed.
A nice method is to hide, with the relative toggle button, all the bones we are not going to set KeyFrames for. This way is easier to see the model during animation and keeps our task simple.
Normally a walkcycle involves four poses, which are commonly known as contact, recoil, passing and high-point. Take a look at Figure 16.71, “Some common poses in a walkcycle.”.
The most important pose is “Contact pose”. Most animators agree every walkcycle should start by setting up this pose correctly. Here the character covers the widest distance it's possible to do in one step. In “Recoil pose”, the character is in its lower position, with all its weight over one leg. In “High-point pose”, the character is in its higher position, almost falling forwards. “Passing pose” is more like an automatic pose in-between recoil and high-point.
The work routine is as follows:
Pose the model in contact pose in frame 1.
Insert KeyFrames for the control bones of your armature (those you use for grabbing, mainly IK solvers).
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 forwards now it will be backwards, and viceversa.
Now once again select your control bones and insert KeyFrames for them.
Go a few frames forward again (it is recommendable that you use the same number of frames as before, an easy choice is to go just 10 frames every ahead time) and press "Paste Pose", this will paste the initial pose ending the cycle. This way we have achieved a "Michael Jackson" style walkcycle since our character never lift its feet up from the ground.
To fix it, go to some intermediate position between the first two poses and move the feet to get something like the Recoil Pose in Figure 16.71, “Some common poses in a walkcycle.”, where the waist reaches its lower position.
Insert KeyFrames and copy the pose.
Now go to a frame between the last two poses (inverse contact and contact) and insert the flip pose. Insert the required KeyFrames and we are done.
If on the contrary you see that the mesh is weirdly deformed, don't panic!, go to EditMode for the armature, select all bones and press CTRL-N. This will recalculate the direction of bones rolls which is what makes the twisting effect.
You should follow the same routine for all the poses you want to include in your walkcycle. I normally use the contact, recoil, and high point poses and leave Blender to make the passing pose.
Now if you do ALT-A you will see our character walking 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.
Now we will focus on making the 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 in the ground plane, trying not to make it too curved for now (the straighter the better), once done let's parent the character's Armature to the path (a normal parent, not a Follow Path!). If everything went OK, we will see our character moving stiffly along the path when pressing ALT-A.
Now go to the NLA window and add the walkcycle action in a channel as an NLA strip. With the strip selected press N and then push the Use Path button.
It is convenient that at the moment of adding actions in the NLA window, that no action is selected for the current armature. Why? Because instead of an NLA strip, we'll see the individual KeyFrames of the action being inserted in the armature channel and this KeyFrames will override any prior animation strips we could have added so far. Anyway, if you do insert an action in this way, you can always convert the KeyFrames into an NLA strip by pressing CKEY.
Now if you start the animation again some funny things might
happen. This is because we haven't set the
This value is the number of Blender Units that should be
covered by a single walkcycle and it is very important that we estimate
it with accuracy. Once calculated we should enter it in the
Num Button which appears if, once you have selected the strip, you press the NKEY.
If we adjust it well and if the walkcycle was correctly set up, our character 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 is multiplied by 2 and by the grid scale (normally 1 grid square = 1 B.U. but this might not be the case, for instance in this example 2 grid squares = 1 B.U.) to provide the required STRIDE value.
In the example there are 7.5 squares with GRID=1.0, since the Grid scale is 1.0 we have: STRIDE = 7.5 x 1.0 x 2 = 15
It's likely that 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 one 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 flat part represents a pause in the movement and it goes from frame 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 the “STAND_STILL” action, this is a pose where our character is at rest. I have defined this action as only one frame by erasing all displacements and rotations of the bones. (See Clearing Transformations), and then moving a couple of bones to get a “resting” attitude.
Since the pause is from frame=78 to frame=112 we should insert
this "still" action exactly there for it to perfectly fit the
pause. For the animation doesn't start nor end briskly we can use
the BlendIn and BlendOut options, where we can set the number of
frames used to blend actions and in this way doing a more natural
transition between them. In this way the character will smoothly
change its pose and everything will look fine. If we do use a
value, to be set in the NKEY dialog, then we should start the action
earlier and finish it
BlendOut frames later, because the character
should be still moving while changing poses.
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 effects will be added from one NLA strip to the precedent strips. So, the best option is to insert the walkcycle and still strips before any other.
To add actions in the NLA window we have to locate the mouse
pointer over the armature's channel and press
SHIFT-A. A menu with all available actions will
pop up. If we don't locate the pointer over an armature channel an
ERROR: Not an
armature" will pop up instead.
So, place the pointer over the armature strip and press SHIFT-A and add the “WAVE_HAND” action.
As this particular action is just the waving of the left arm to say “hello” during some point in the walkcycle, we will not use the “Use Path” option but move it in time so it overlaps the arms KeyFrames from the walkcycle action. Move the pointer over the strip and press NKEY or just drag it and scale it to your satisfaction.
Since this action is the last to be calculated (remember Blender evaluates actions from Top to Bottom in the NLA Editor), it will override any KeyFrames defined for the bones involved in the precedent actions.
Well, there is not much left to say about NLA and armatures. Now it is time for you to experiment and to show the results of your work to the world. One last recommendation though: it is possible to edit KeyFrames in the NLA window. We can duplicate frames (SHIFT-D), grab KeyFrames (GKEY) and also erase KeyFrames (XKEY), but if you do erase KeyFrames be careful because they will be lost forever from the currently selected action. So be careful and always convert to NLA strip before erasing anything.
Bye and good luck blenderheads!!