Sub topic 3
Posing with Forward Kinematics
This chapter assumes you can create an armature, add bones in Edit Mode, switch between Object, Edit, and Pose Mode, and insert basic keyframes. The scripted examples need only basic Python. By the end you should be able to explain how forward kinematics (FK) works, pose a chain by rotating its bones, and decide when FK is the right tool.
What FK Means
Forward kinematics is a posing method where you set each joint's rotation yourself, and the end of the chain lands wherever those rotations put it. To place a hand, you rotate the shoulder, then the elbow, then the wrist. The hand has no say in the result. It is a consequence of the joints above it.
This works because of the parent hierarchy covered in the previous chapter. Each pose bone is transformed relative to its parent, so rotating a parent carries every child along with it. The final position of a bone is the combination of every transform from the root down to that bone.
How a Pose Is Built Down the Chain
Take a two-bone arm with upper_arm as the parent and forearm as the connected child. Rotating upper_arm by 40 degrees swings the whole arm, including the forearm. Rotating forearm by 60 degrees afterward bends only the elbow, and the forearm rotates around the point where it joins the upper arm.
The order in which you work matters in practice, even though the final result depends only on the values. Pose from the root outward. If you fix the hand position first and then rotate the shoulder, the hand moves away from where you put it, and you have to correct it again.
Rotation Modes
Each pose bone has a rotation mode. The default is Quaternion (WXYZ). You can switch it to Euler or Axis Angle in the Bone tab of the Properties editor.
| Mode | Strengths | Weaknesses |
|---|---|---|
| Quaternion (WXYZ) | No gimbal lock, smooth interpolation | Hard to edit by hand, no per-axis curves that map to intuitive angles |
| Euler (XYZ and others) | Easy to read and edit, one curve per axis | Gimbal lock is possible, and the axis order matters |
| Axis Angle | Rotation described as one axis plus one angle | Rarely used for character work |
For hinge joints such as elbows and knees, Euler rotation is usually easier to work with, because the bend sits on a single axis. Limits and locks (covered in later chapters) also work most predictably with Euler rotation. For a shoulder or spine that turns freely in many directions, quaternions avoid gimbal lock.
Switch a bone's mode with Python like this:
import bpy
rig = bpy.data.objects["ArmRig"]
bone = rig.pose.bones["forearm"]
bone.rotation_mode = 'XYZ' # use Euler for a hinge joint
print(bone.rotation_mode)Changing the mode does not convert the existing values. If a bone already holds a quaternion pose and you switch to Euler, the Euler fields start at their own stored values, which may be zero. Set the mode before you pose or keyframe the bone.
Rotating Bones Interactively
In Pose Mode, select a bone and press R to rotate it. The common variations are:
RthenX,Y, orZlocks rotation to an axis. Pressing the same letter again switches between global and local axes.Rthen a number types an exact angle in degrees.Alt+Rclears the rotation of the selected bones.Alt+G,Alt+R, andAlt+Sclear location, rotation, and scale, which returns a bone to its rest pose.
To reset the whole rig, select all bones with A and clear all three transforms.
Locations on a pose bone work in the same way, but they behave differently depending on the bone. A bone connected to its parent cannot move away from the parent's tail, so G has no effect on it. Unconnected bones can be moved, which is useful for root and control bones.
Posing from a Script
You can set the same values through Python. The following example bends the elbow of the arm built in the earlier chapters. It assumes the rig named ArmRig exists and is in Pose Mode.
import math
import bpy
rig = bpy.data.objects["ArmRig"]
upper = rig.pose.bones["upper_arm"]
fore = rig.pose.bones["forearm"]
upper.rotation_mode = 'XYZ'
fore.rotation_mode = 'XYZ'
upper.rotation_euler = (0.0, 0.0, math.radians(30.0))
fore.rotation_euler = (math.radians(60.0), 0.0, 0.0)
bpy.context.view_layer.update()
print(fore.head, fore.tail)The values are in radians, so convert degrees with math.radians. The values you assign are local to each bone, along the bone's own axes. The head and tail of a pose bone are reported in the armature's object space, which lets you check where the result ended up.
Keyframing an FK Pose
FK animation is the plainest form of rig animation. You pose a few key moments, insert keyframes, and let Blender interpolate between them. In Pose Mode, press I with bones selected. Pose Mode keyframing works on the properties you choose, such as rotation only.
From Python, keyframe the rotation of a bone with keyframe_insert:
import math
import bpy
rig = bpy.data.objects["ArmRig"]
fore = rig.pose.bones["forearm"]
fore.rotation_mode = 'XYZ'
fore.rotation_euler = (0.0, 0.0, 0.0)
fore.keyframe_insert(data_path="rotation_euler", frame=1)
fore.rotation_euler = (math.radians(90.0), 0.0, 0.0)
fore.keyframe_insert(data_path="rotation_euler", frame=24)This creates an action on the rig with F-curves for each rotation channel. Key only the channels you need. Keying location and scale on every bone clutters the Graph Editor and makes the animation harder to edit later.
Strengths and Weaknesses of FK
FK suits motion that flows from the root outward and does not need the end to stay in place.
| Good for FK | Poor for FK |
|---|---|
| Arms swinging while walking | A hand resting on a table while the body moves |
| Spines, tails, tentacles, and hair | A foot planted on the ground during a step |
| Overlap and follow-through, where the tip lags the base | Reaching for a specific point in space |
| Fine control over the arc of a motion | Any pose where the end must stay fixed |
The main weakness is the contact problem. Suppose a character's hand rests on a table, and you rotate the shoulder. Every child follows, so the hand slides away from the table. You then have to fix the elbow and wrist on every frame. This is the problem inverse kinematics addresses, and the next chapter explains how.
Common Mistakes
- Editing in Edit Mode by accident. If a bone moves but its pose values stay at zero, you changed the rest pose. Return to Pose Mode.
- Keying a rotation mode you are not using. If the bone uses Euler but you keyed
rotation_quaternion, the animation has no visible effect. - Posing the tip first. Rotating a parent afterward moves everything below it, which undoes your work.
- Expecting
Gto move a connected bone. A connected bone has a fixed head. Move its parent or rotate it instead. - Leaving stray values in other channels. Use
Alt+Rbefore posing to start from a clean rest pose.
Exercise
A forearm bone is keyed on rotation_quaternion, but its rotation mode is set to XYZ Euler. You change its pose in the viewport and nothing in the animation seems to affect it. Why, and how do you fix it?
Show answer
The animation plays back on the quaternion channels, but the bone uses its Euler values to calculate the pose, so the keyed data does not drive the visible result. Set the rotation mode before keyframing, then delete the unused quaternion keys and key rotation_euler instead. Alternatively, switch the bone back to Quaternion so the existing keys apply.
Exercise
A character's hand rests on a table. You rotate the shoulder bone with FK to lean the body forward. What happens to the hand, and why?
Show answer
The hand moves along with the arm and leaves the table. Rotating a parent carries every child with it, and FK has no way to hold the end of the chain in place. You would need to correct the elbow and wrist by hand, or use IK, which solves the joints from the hand's position.