Animating a Walk Cycle for a Character in Blender

 We've made a character model in Blender, and we've added bones to it so we can move it around. Now we can start moving this character into poses which we can save to create animations.

I'm going to start with a simple bit of animation - the character walking forwards. This type of animation is called a "walk cycle", and if you look up walks cycles online, you'll find lots of reference images that show what poses we'll create and what order they'll go in. I often take cues from this image by idleworm.com, for example, since it has the cartoony look I'm going for:


We only need to worry about the first five poses for Blender. Everyone seems to have different names for what these poses are - I like to call them the left-heel, the stomp, the pass, the spring and the right-heel.

In Blender, we save our poses as animation keyframes in the dope sheet window. To open up a new viewport window, move the cursor up to the very top-right of the viewport, until it turns into a four-lined reticule.


When you see this reticule, click and drag to the left and a new viewport window will open up.


In this new viewport, click on the editor mode icon in the very top-left (it looks like a ball floating above some lines), and change the editor mode to "Dope Sheet".


Inside this dope sheet, there will be a timeline. If we put our character into a pose and save that pose somewhere on the timeline, the character will automatically move into that pose when the timeline plays.


There is another timeline already present in the Blender scene you can use. It's way at the bottom underneath the viewport, hidden from view. If you take your cursor down until it turns into two opposing arrows, then click and drag, the timeline will appear from out the bottom. It will have the same values as whatever's going on in the dope sheet timeline.


At the top of the dope sheet, where it says "Dope Sheet", click on it and change it to "Action Editor". This will allow us to save strings of poses as one "action".


At the top-right of the dope sheet, click where it now says "New" to create a new action.


I've re-named this action "Walk". Now we can start animating our character over in the pose mode viewport.


The Heel

Let me begin by moving my timeline playhead over to frame 1 - the very start of our animation.


Now let's actually pose our character. Click on any of the bones and hit G for grab to move them around, then click again to set them in that area.


If you feel like those bulky-looking bones are getting in the way, you can change the way they look by going into the Data tab in the inspector side menu, going down to viewport display, and, where it says "Octahedral", change it to a different option to change the way the bones look. "Stick" and "wire" are popular options if you want to see what you're doing.


...now I'm starting to see where I need to do some better weight painting. You can freely chop-n-change between all the different modes if you feel you need to make some alterations (remember, in Object mode, click the bones first, then shift-click the body to access weight painting mode).


It's really up to you how it is you want to pose the character, but it helps to keep an image of a walk cycle on hand to draw inspiration from. If you ever want to restore your character back to their default pose, select all the bones with A and hit Alt+G, Alt+R and Alt+S, to restore their original position, rotation and scale values respectively.


Anyway, let's start with our actual heel pose. I've brought the pelvis down a little bit so the character has a slight bend in their knees.



From side view, I've moved both feet so one's in front of the other, while the other is a little out back. Both of them are just about touching the floor - the front foot by its heel, the back foot by its toes.


It looks a little out-of-whack from the front, so I've made some alterations in front and back view to bring the legs a little closer together.


Now I've moved one arm a little out in front and the other further back. When you're walking, the arms tend to sway in the opposite direction of the legs - so if your left foot's forward, your left arm will be back.


I've rotated their ribcage a little away from the front arm, so it looks like they're swaying...


...and I've straightened out the head so they're looking where they're going.


I've also rotated the abdomen bone a little downward so it looks like they're leaning into the walk, and straightened the chest and head to face forward again.


Finally, I've bent the arm out front slightly inward so it looks like they're swinging it a little in front of their body.


And I think that will do for our first pose. I could pose the finger bones and clench the hands into fists, but I want to make this quick.

After double-checking that everything looks how I want it (and that the playhead in the timeline is on frame 1), I'm going to hit A in the pose mode viewport to select all the bones, right-click and select "Insert Keyframe". A keyframe is essentially a saved pose - it saves the position and rotation of where the selected bones are, so they can be put into a timeline and made to go into that position at a certain time.


A new menu will open up with some options to choose from. I'm going to pick "Location and Rotation", so it will save the location and rotation of all my bones as keyframes (if I had scaled anything, I'd want to pick "Location, Rotation & Scale" instead).



In the dope sheet, this big list of all our keyframed bones will appear. The yellow dots are the keyframes themselves - the saved position of those bones.


The Reverse-Heel

To show you what I mean by all these keyframes, I'm going to move my playhead in the dope sheet up to the 13 frame mark (this is how long one of our character's steps will be).


Now, back in the pose mode viewport, I'm going to hit A to select all the bones and Ctrl+C to copy the pose. Then, I'll press Shift+Ctrl+V to flip the pose and paste it. Now the character will be in the same pose, but with their other foot forward this time.


Once again, I'm going to right-click, select Insert Keyframe, select Location and Rotation, and new keyframes for this pose will appear at the playhead's position in the dope sheet.


Now, try dragging the playhead between these two keyframes and see what happens.


The character will actually slide between one pose and the next. Blender automatically interpolates (smoothly moves) the character between the keyframes. Press the play button at the top of the timeline or the space bar to see this animation play out in real-time.

The Pass

Let's bring the playhead now to frame 7 and pose the character again, this time to create the passing pose. Let me start by making it so the character's left leg is flat against the ground.


Then I'll move the character's right leg a little upwards so it looks like it's swinging past.


I'll raise the pelvis a little, then hit A to select all the bones, right-click, insert keyframes and make it location and rotation. Now the walking animation should look a little more natural.


The Stomp

Now I'll move on to the stomp pose for frame 4. The forward foot is flat on the ground in this one.


Meanwhile, the character's pelvis is at its lowest point in the cycle. 


The back leg, meanwhile, trails a little further back, with only the toes just about touching the floor.


This looks good. We'll hit A again, then right-click to add another Location and Rotation keyframe.


The Spring

Finally, at frame 10, we'll do our spring pose. Here, the character's pelvis is at its highest point.


The forward foot is a little flat as it's about to hit the ground.


You know the drill - A to select all the bones, right-click to insert a keyframe, then location and rotation.



Mirroring the Second Step

Now we've finished the first step of the walk cycle, it's time to animate the second step - but since the second step is just a mirrored version of the first step, we don't need to make new keyframes in pose mode again. In the dope sheet, make sure all the keyframes are selected (and highlighted in orange) by pressing A in the dope sheet window. Make sure the bones are also all selected by pressing A in the pose mode menu.


Now hit Ctrl+C to copy these keyframes. Since when we paste them they'll appear at where the playhead is, let's move the playhead up to the final keyframe at frame 13.


Now press Shift+Ctrl+V in the dope sheet, just like we did to flip the pose in pose mode, only this time it will flip the whole animation - new keyframes will appear, this time playing a mirrored version of the animation we just made.


So now, when we play the animation with the space bar, the character walks in a natural-looking way... for about a second, then they just freeze in mid-stride. Over on the right-hand side of the bottom timeline, there's two buttons - one that says "Start", with the frame where the animation starts playing, and one that says "End", which is the frame where the animation stops playing.


250 frames is a little bit long for our animation (for reference's sake, it's about 30 frames per second), so I'll change the end frame value to 24 (it's alright to cut off the last keyframe since it's a repeat of our first keyframe).



Now, if we play our animation, our character walks smoothly ahead.


Now, the animation stutters a little when it repeats, so I'm going to select all the keyframes with A and use G to grab them and move them so the first keyframe starts on frame 0. Then I'll decrease the end point to 23.



The Graph Editor

If you want to change some specific details about the way the character moves between keyframes, you can do so in the Graph Editor. Click on the clock symbol in the top-left of the bottom timeline and change it to Graph Editor mode.


A bunch of line graphs will appear that show how the character's bones move across the animation on the X, Y and Z axes. I'm not going to pretend to understand any of it, but I do know that if you click where it says "Key", then go up to "Interpolation Mode", you can change the way the character moves between keyframes.


  • "Bezier" is the mode that's currently selected. This makes the character move smoothly between the keyframes, so it looks as realistic as possible.
  • "Linear" makes the character's body parts all move at the same speed between the keyframes. This makes them look like they're a robot.
  • "Constant" just snaps from one keyframe to the next and doesn't have the character's body move between them. This can produce a stop-motion effect.

Saving the Animation

Back in the dope sheet, at the top-right where we first created and named our action, there are three buttons beside the action's name (if you don't see them, try dragging the dope sheet window's side further to the right).


The shield button is the "Fake User" button - pressing this button just makes absolutely sure that Blender saves this animation. As it is now, Blender will only save the animation if it's being used somewhere in the scene. If it's not being used on any object by default, then if I were to close this Blender project and open it again, the walk animation would disappear. So it's best we make sure this shield button is pressed (turning it blue with a tick) so the animation stays in the Blender file even if it's not currently being used.


The button next to it with two files is the "Create New Action" button, which is what you press whenever you want to add and name a new animation. The button next to that is the "Unlink Action" button - it doesn't delete the animation, it just takes you out of editing it. You can access it again in the "Browse Action" button to the left of the animation's name.

Anyway, when you go into object mode, the character keeps their animation (though when you switch to edit mode, it will go back into its original pose). Still, I'd rather keep it still in object mode, so I've created a new action and called it "Default Pose", and pressed the shield button to save it.


In the dope sheet, I've used A to select all the keyframes and hit "Delete" to remove them. Then, in pose mode, I've hit A to select all the bones, and pressed Alt+G, Alt+R and Alt+S, to restore the character's bones back to where we originally put them.


Finally, with the playhead on frame 0, I've right-clicked in pose mode to insert a new keyframe, and selected Location and Rotation.


I can switch between these two animations in the top-right of the dope sheet if I want to see the character walk again.


By the way, you remember having to draw this character first to create the model for them? Now that you've made a poseable model, you never have to remember what your character looks like. You can use Blender to create little scenes you can springboard into drawings, and it'll give you a proper sense of proportion.


And before anyone starts accusing me of cheating or tracing - I've seen people on ArtStation do this! A lot of professionals use Blender to create models for characters and objects they've drawn, so they can pose them in a scene they can then copy into a perspective drawing. ...Fine, maybe they don't trace it one-to-one, but being able to make your own custom reference images like this is a godsend if you struggle with perspective and foreshortening like I do.

Next time, we might look at making a more detailed Blender model through sculpting. Right now I don't know how any of that works, so I'll need to watch some tutorials on it myself.

Comments

Popular posts from this blog

Waiting for Godot (to Work)

Help with Writing - Story and Scene Structure

Making a TileSet for Godot