Creating a simple walk cycle for the character by assigning keys to the bones
We are now going to create a simple walk cycle for the Gidiosaurus character by assigning position and rotation (and in some cases, also scaling) keys to the control bones of the rig.
In Blender, there is already a preset screen layout named Animation that you can switch to and start animating. By the way, I usually prefer to set up my screen layout for the required task, and animating is no exception, so let's first prepare the scene and the screen for the job:
- Open the
Gidiosaurus_proxy.blend
file. - If necessary, enable the 3D manipulator widget in the toolbar of the 3D view (press Ctrl + Spacebar), click on the Translate icon button, and set Transform Orientation to (just for the moment) Global.
- Split the 3D view horizontally into two windows and change the bottom one into a Dope Sheet window. Click on the Editing context being displayed button on its toolbar to switch from Dope Sheet to the Action Editor context Mode.
- Go to the Properties sidepanel of the 3D viewport (use the N key to make it appear if necessary) and under the Rig Layers subpanel, disable the Arm.L (FK), Arm.R (FK), Leg.L (FK), and Leg.R (FK) buttons.
- Select the Gidiosaurus_proxy rig, making sure you're in Pose Mode, and select the hand.ik.L control bone. Go to the Rig Main Properties subpanel under the Properties panel and set the FK / IK (hand.ik.L) slider to 1.000:
- Repeat for the hand.ik.R bone and for the foot.ik.L and foot.ik.R control bones as well.
- Go to the Scene window, enable the Simplify subpanel, and set the Subdivision level to 0 (or, if you have a more powerful machine than my laptop, also to 1).
- Go into the Side view and press the 5 key on the numpad to go into the Ortho view.
- Click on the red button icon (Automatic keyframe insertion for Objects and Bones) in the Timeline toolbar.
- Save the file as
Gidiosaurus_walkcycle.blend
.
To create a walk cycle, it's important to first establish the start and the end poses of the walk, so let's pose our character for his first step:
- Be sure to be in the first frame (which in Blender is frame 1 and not 0), both by clicking on the Jump to first/last frame in frame range left button on the Timeline toolbar or by pressing the Shift + Left Arrow keys.
- Select the foot_ik.R control bone and, by using the widget, move it backward on the global y axis to around 0.350.
As you release the mouse button, an Action datablock, automatically named Gidiosaurus_proxyAction, is created and a keyframe for the foot_ik.R bone is automatically added in the first frame in the Action Editor window. We can also see the value for the movement on the y axis in the Transform subpanel.
Note that all the transformation value slots turned yellow; this is to show that at the current frame, an animation keyframe exists for all those values:
- Temporarily, switch 3D View to the Graph Editor window:
As you can see, because we enabled the red button icon (Automatic keyframe insertion for Objects and Bones) in the Timeline toolbar, every time we move, rotate, or scale a bone, a keyframe for Location, Rotation, and Scaling is automatically added to the Action. This can be handy, but also results in a lot of useless keyframes, for example, for most of the rig bones, we need to set keys for the Location and/or the Rotation, but very rarely for the Scaling.
- Put the mouse cursor inside the Curve Editor area of the Graph Editor and press the A key to deselect everything.
- Shift + left-click on the Scale and Quaternion Rotation items in the Gidiosaurus_proxy Channel Region to select them, then press X to delete them:
- Switch back to the 3D View, and in the Transform subpanel in the Properties sidebar (and in the Transform subpanel under the Bone window in the main Properties panel), now only the Location slots are highlighted in yellow.
- Disable the red button icon (Automatic keyframe insertion for Objects and Bones) in the Timeline toolbar.
- Go to frame 21 by grabbing and moving the Time Cursor inside the Timeline window or the Action Editor window, or by typing the frame number inside the Current Frame button on the Timeline toolbar.
- Select the foot_ik.R control bone and by using the widget, move it forward on the global y axis for around -0.440.
- Press I and in the Insert Keyframe Menu, select the Location item; this adds a second key to the foot_ik.R bone at frame 21, but this time only for Location:
- Go to frame 41, right-click to select the key at frame 1 in the Action Editor window, and press Shift + D to duplicate it, then move the duplicated key to frame 41.
- Put the mouse cursor in the Timeline and press the E key to set the total length of the animation to the current frame position:
- Still at frame 41 (but this being a cycle, frame 1 could also be fine) and with the foot_ik.R bone selected, click on the Copy the current pose of the selected bone to copy/paste buffer button on the 3D viewport toolbar.
- Go to frame 21 and select the foot_ik.L bone, then click on the Paste the stored pose on to the current pose button at the extreme right side of the 3D viewport toolbar to paste a mirrored pose.
- Press the I key and in the pop-up menu, click on the Location item to add a new key:
- Now, still at frame 21, select the foot_ik.R bone and click on the Copy the current pose of the selected bone to copy/paste buffer button on the 3D viewport toolbar.
- Go to frame 1, select the foot_ik.L bone, and again click on the Paste the stored pose on to the current pose button to paste the reversed pose, then press I and insert a Location key.
- Select and duplicate the new key at frame 1 for the foot_ik.L bone and move the duplicated one to frame 41:
At this point, by scrolling the Time Cursor in the Timeline, in the Action Editor window, or by clicking on the Play Animation button in the Player Control on the Timeline toolbar, we can already see a complete shuffling cycle of the movement of the feet of the Gidiosaurus:
- Now go to frame 1, select the torso bone, and lower it on the z axis for almost -0.200, then assign a position key.
- Select the just added torso bone key in the Action Editor window, press Shift + D to duplicate it, and move the duplicate to frame 21, then repeat for frame 41:
- Go to frame 11, select the foot_ik.R bone, and move it on the z axis for 0.200, then assign a position key.
- As we already did at steps 16 and 17, copy the bone pose, go to frame 31, and paste it reversed, then assign a position key to the foot_ik.L bone.
- Working in the same manner, select the hand_ik.R and .L bones and animate them according to the Gidiosaurus' walk (note: as for any average walk cycle, in the opposite position with respect to the feet):
- Reselect the torso bone, go to frame 1, and move it forward for 0.240 on the y axis. Assign a new position key (to overwrite the old one), then delete the keys at frames 21 and 41 and substitute them with duplicates of the new frame 1 key.
- Go to frame 11 and move the torso bone for almost 0.200 upward on the z axis. Duplicate the key for frame 31.
- Go to frame 1 and select the toe.R bone, then assign a rotation key. Go to frame 11 and rotate the bone on the normal x axis (the red circle in the widget tool with Transform Orientation set to Normal) for 75°. Go to frame 21 and press Alt + R to clear the rotation pose and assign a rotation key. Use Shift + D to duplicate the last added key and move the duplicated one to frame 41.
- Select the toe.L bone and assign a rotation key at frame 1, then go to frame 21 and repeat. Copy the toe.R pose at frame 11 and paste it reversed for the toe.L bone at frame 31, then assign a cleared rotation pose key at frame 41:
- Following the previous procedures, set keys for the position and/or the rotation of all the affected bones, also adding movements such as the rotation of the torso and of the hips, the position of the pole target for legs and arms, the swinging of the head to compensate for the body's lateral movements, the closed mouth and the open eyelids, and so on:
The animation cycle, at this point, looks really stiff and robotic. This is simply because everything happens at the same time, that is, in the same frame, as you can easily see in the Action Editor window (to enlarge a window, put the mouse cursor inside it and press Ctrl + Up Arrow; to go back, press Ctrl + Down Arrow):
To make the animation look more realistic and natural, we must offset some of the keys to make the different actions happen at different times; for example, the torso bone goes down a few frames later than the foot touching the ground, and goes up a few frames later as well, the same for the head swinging, and so on.
- To offset the affected keys, simply select and/or Shift-select and move them for the required frames, forward or backward in the Action Editor window. Here, a bit of testing is needed to reach the right number of frames (usually in the range of 3-5 frames, by the way).
- Where a hole happens at frame 1 in the action channel for a bone because of the dislocation of the keys, simply duplicate the last right side key of that bone and move it to the appropriate negative frame position. That is, to the left side of frame 0, and be sure that the relative item, Allow Negative Frames, is enabled in the Editing tab of the User Preferences panel, as you can see in the following screenshot for the torso and for the elbow_target_ik bones:
- Rename the action
Gidiosaurus_Walkcycle
. To better check the playing animation, go to the Timeline toolbar to set the end frame for the total length of the animation to 40 frames, because frame 1 and frame 41 are the same poses. - Save the file.
At this point, we have made our first action with the Gidiosaurus character, and it's a 41 frame-long walk cycle meant to be repeated in loops for longer animations.
Because in the next recipe we are going to use the Non Linear Action Editor (NLA Editor) to re-use the action datablocks to build the final animation, we need now to create some more actions to be mixed with the walk cycle one.
- Activate the Fake User for the Gidiosaurus_Walkcycle action by clicking on the F icon button to the side of the action datablock on the Action Editor toolbar, then click on the X icon button to unlink the action datablock.
- Put the mouse cursor in the 3D viewport and press the A key to select all the control bones, then press Alt + G, Alt + R, and Alt + S to clear any position, rotation, or scale and restore the rig default pose (actually, the only control bones using the scale operator for the animation are the fingers, which we haven't animated so far).
- Be sure to be at frame 1 and zoom to the character's head, select the head.001 and neck bones, and assign a rotation key, then select the ctrl_mouth bone and assign a position key.
- Rename the action
Gidiosaurus_Roar
, then enable the Fake User; use Shift + D to duplicate the keys and move the duplicated ones to frame 21. - Go to frame 15 and rotate the head.001 and neck bones clockwise to raise the head, then open the mouth wide by moving the ctrl_mouth bone down.
- Go to frame 7 and rotate the head.001 and neck bones counterclockwise a bit to lower the head:
We have now built a roar action for the Gidiosaurus, but it happens in only 21 frames, so it's really too fast. Although it is possible to scale any action strip in the NLA Editor window, in this case it's better to do it directly in the basic action itself.
- In the Action Editor window, put the Time Cursor to frame 1, then press the A key to select all the keys of the action. Press S | X | 2 | Enter to scale the action of the double to frame 41:
- Now that the action length has been doubled, we can move some keys of a few frames and also animate the movement of the character's tongue a bit during the roar:
- Again, click on the X icon button to unlink the action datablock, select all the bones, then press Alt + G and Alt + R to clear the poses.
- Shift-select the thumb.R and .L, f_index.L and .R, and f_middle.L, and .R control bones and add a Scaling key. Rename the newly created action
Gidiosaurus_Fingers
and enable the Fake User: - Now Shift-select for both the .L and .R bones, thumb.01, thumb.02, and thumb.03, f_index.01 and f_index.02, f_middle.01 and f_middle.02, and the palm control bones, then add a Rotation key:
- Now that we have all the finger bones' names in the Action Editor list-tree to the left (the Channel Region), start to click on the bone names to highlight them, for example, click on the thumb.L item, then press Shift + PageUp keys to move it to the top of the list.
- Then highlight the thumb.01.L bone and by pressing the PageUp arrow, move it right after the thumb.L bone (press Shift + PageUp to eventually go directly to the top). Repeat with the thumb.02.L and the thumb.03.L bones, then go to the thumb.R bone, and so on. To move an item downward in the list-tree, simply press the PageDown key instead (or Shift + PageDown to go directly to the bottom).
- Repeat the ordering until you have grouped the bones' names by finger in the list-tree, to make it easier to individuate them in the Action Editor window, then use Shift + D to duplicate all the keys and move the duplicated ones to frame 41.
- Go to frame 21, select thumb.L, .R, f_index.L, .R, f_middle.L, and .R bones and press S to scale them to 0.900. Assign a Scaling key, then select and rotate the other control bones, and assign Rotation keys (be aware that the previous scaling bones can also be rotated). Also, by using the Copy/Paste technique already shown, build a kind of creepy hands animation:
- When you are done, thanks to the re-ordering we made in the Channel Region, go to the Action Editor window and move groups of keys based on their finger group; in short, to avoid the everything-at-the-same-time issue, dislocate the timing of one finger with respect to the others:
- After this, click on the Display number of users of this data button to create a new copy of the action and change the name to Gidiosaurus_Fingers.L. In the Channel Region, Shift-select all the .R bones items and delete them (X key), then enable the Fake User.
- Click on the double arrows icon to the left side of the datablock name (Browse Action to be linked) and reselect the Gidiosaurus_Fingers action.
- Again, click on the Display number of users of this data button to create a new copy of the action and change the name to Gidiosaurus_Fingers.R. Shift-select all the .L bones items and delete them. Enable the Fake User and click on the X icon button to unlink the action datablock.
- Save the file.
To have a look at the completed walk cycle of the Gidiosaurus and the other actions, open the Gidiosaurus_walkcycle_final.blend
file provided with this cookbook.
An Action is a bones F-Curves datablock created at the same moment any animation key is added through the Insert Keyframe Menu (I key) or the red button icon (Automatic keyframe insertion for Objects and Bones) in the Timeline toolbar. The newly created Action automatically takes the name from the object itself (Gidiosaurus_proxy in this case) plus the Action suffix.
The Actions are stored inside the .blend
file, but thanks to the Fake User they don't necessarily need to be linked to the rig to be preserved after saving and closing the file.
Note that the scaling operation for the selected keys of an Action in the Action Editor window (and the same for the Graph Editor and the NLA Editor) use the Time Cursor position as the pivot point. Also note that even though we did it in our recipe, it wasn't mandatory in this case to declare the x (horizontal) axis for the scaling.
Organizing the bones' names in the list inside an action in the Action Editor window is a good way to quickly find the required item, but it can be improved even further by Bone Groups:
- Open the
Gidiosaurus_library.blend
file and go to the Outliner; click on the eye icon to the side of the rig item to unhide it. - Select the rig and go to the Object Data window, then in the Bone Groups subpanel, click on the + icon to add a bone group.
- Double click on it to rename it thumbs, then go into the 3D viewport and Shift-select all the thumbs' bones.
- Click on the Assign button, then click on the Color slot to choose a Theme Color Set from the pop-up menu:
- Repeat the steps from 2 to 4 for the other two fingers, thus creating the indexes and middles bone groups and selecting a different Theme Color Set option for each group:
- In the Outliner, hide the rig item again and save the file.
- Re-open the
Gidiosaurus_walkcycle.blend
file; the colored bones don't show in the proxified rig, and this is because we had already proxified it and only later assigned the bone groups to the library file. - The solution to fix this is simply to select the affected bones one at a time and by going to the Relations subpanel under the Bone window, click on the Bone Group empty field to select the name of the appropriate group:
By the way, it is always better to do the Bone Groups before the proxy, if possible.
The colors of the Bone Groups also show as background color for the bone channels inside the Action Editor window, making it a lot easier to select all the bones of a group; just be sure to have the Show Group Colors item enabled in the View menu on the Action Editor toolbar:
You can find the library with the colored fingers' control bones under the alternative file named Gidiosaurus_library_colors.blend
.
The walk cycle and the other actions we built in this recipe are, from an animation point of view, very simple and basic, not meant to teach you how to animate but only to show enough of Blender's tools for you to easily start animating a rigged character.
If you want to go deeper into the animation process, in Blender or not, here are some links to visit: