Sub topic 15
Bone roll and local axes
This chapter assumes you can already create bones in Edit Mode, parent them, and rotate pose bones in Pose Mode. It covers the third degree of freedom of a bone, its roll. Roll decides where the bone's X and Z axes point, and those axes decide what "rotate around X" means when you pose or constrain the bone.
Local axes of a bone
A bone has a head and a tail, and the line between them gives the bone its direction. Blender builds a local coordinate system from that line:
- Y axis: points from the head to the tail. This is the bone's long axis.
- X and Z axes: perpendicular to Y and to each other.
Head and tail fix the Y axis, but a line leaves one thing open: how the bone is spun around itself. Roll is that spin, measured in the bone's Y axis as an angle. In Edit Mode it appears as the Roll field in the Item tab of the sidebar (N) and as EditBone.roll in Python, in radians.
Roll is measured from a reference orientation that Blender derives from the bone's direction. For that reason, the same roll value on two bones that point different ways gives different axes in world space. Compare axes visually instead of comparing numbers.
To see the axes, enable Axes under Armature data properties > Viewport Display. Each bone then shows its local X, Y and Z.
Why roll matters
Roll changes nothing about where the bone sits. It changes how every local-space operation reads the bone:
- Pose rotation. With the rotation mode set to XYZ Euler, the three values rotate around the bone's own X, Y and Z. A finger with a sensible roll bends on X alone. A badly rolled finger needs a mix of X and Z to curl.
- Local-space constraints. Copy Rotation, Limit Rotation and similar constraints set to Local Space use these axes.
- Mirroring. Left and right bones need matching axes, or the same animation curve moves them in different ways. See the mirroring chapter for the symmetry workflow.
- Bendy bones and twist. Twist along Y is applied relative to the roll, so a consistent roll keeps the twist predictable.
- IK limits. Per-bone IK limits are expressed in local axes, so they rely on the same convention.
Reading and setting roll with Python
The script below makes two bones with the same head-to-tail direction and different roll. It then prints the X axis of each bone in armature space, taken from the rest-pose matrix Bone.matrix_local.
import math
import bpy
arm_data = bpy.data.armatures.new("RollDemo")
arm_obj = bpy.data.objects.new("RollDemoRig", arm_data)
bpy.context.collection.objects.link(arm_obj)
bpy.context.view_layer.objects.active = arm_obj
arm_obj.select_set(True)
arm_data.show_axes = True # draw local axes in the viewport
bpy.ops.object.mode_set(mode='EDIT')
flat = arm_data.edit_bones.new("flat")
flat.head = (0, 0, 0)
flat.tail = (0, 1, 0)
flat.roll = 0.0
rolled = arm_data.edit_bones.new("rolled")
rolled.head = (2, 0, 0)
rolled.tail = (2, 1, 0)
rolled.roll = math.radians(90)
bpy.ops.object.mode_set(mode='OBJECT')
for bone in arm_data.bones:
x_axis = bone.matrix_local.to_3x3().col[0]
print(bone.name, tuple(round(v, 3) for v in x_axis))Both bones point along +Y. The X axis of flat stays on the world X direction, and the X axis of rolled turns a quarter turn around Y. Edit bones exist only in Edit Mode, so the script reads arm_data.bones after returning to Object Mode.
Recalculating roll
Setting roll by hand is slow for a whole rig. The Edit Mode operator Armature > Recalculate Roll (Ctrl+N) sets the roll of the selected bones so their axes line up with a chosen reference.
| Option | Aligns the bone's axis with |
|---|---|
| Local +X / +Z Tangent | The tangent of the bone's parent chain, which is useful for limbs and spines. |
| Global +X / +Y / +Z | The matching world axis. |
| Active Bone | The axes of the active bone. |
| View Axis | The current viewport direction. |
| 3D Cursor | The position of the 3D cursor. |
The Flip Axis option reverses the chosen alignment, and Shortest Rotation limits the change to the smaller of the two possible turns. In Python:
import bpy
arm_obj = bpy.data.objects["RollDemoRig"]
bpy.context.view_layer.objects.active = arm_obj
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.armature.select_all(action='SELECT')
bpy.ops.armature.calculate_roll(type='GLOBAL_POS_Z')
bpy.ops.object.mode_set(mode='OBJECT')The operator acts on selected bones, so the script selects all of them first.
Common errors
- Changing roll after animating. Keyframed rotation values are stored in the bone's local axes. Rolling the bone later changes what those values mean, and existing poses and actions look wrong. Fix roll before you animate, or re-key afterwards.
- Changing roll after skinning. Rest-pose geometry stays the same, but any weight or constraint set up in local space may need rechecking.
- Inconsistent roll along a chain. A spine where each bone has a different roll makes the rotation channels unpredictable. Use Recalculate Roll on the whole chain.
- Mirrored bones with unequal roll. After you mirror a rig, check the axes on both sides. Poses copied with Paste Flipped depend on a consistent convention.
- Confusing roll with rotation in Pose Mode. Pose rotation is applied on top of the rest orientation. Roll belongs to the rest pose and can only change in Edit Mode.
- Assuming roll 0 means world-aligned. It does not, because roll is relative to a direction-dependent reference.
Choosing a roll convention
Pick one rule and apply it to the whole rig:
- For limbs, align the bending axis with local X, so elbows, knees and fingers bend on one channel.
- For the spine and neck, use a tangent-based or a global alignment so every bone in the chain bends the same way.
- For mirrored sides, build one side, then mirror it, and verify the axes on both sides.
- Run Recalculate Roll before skinning and animation, then leave roll alone.
Exercise
A bone's X rotation channel bends an elbow sideways instead of forward. The bone's head and tail are correct. Which property do you change, in which mode, and why is it better to fix it before animating?
Show answer
Change the bone's roll in Edit Mode, either in the Roll field or with Recalculate Roll (Ctrl+N), so the local X axis lines up with the elbow's bending direction. Roll does not move the head or tail. Keyframed rotation values are stored relative to the local axes, so changing roll after animating changes the meaning of the existing keys and spoils the poses.
Exercise
Why can two bones with the same roll value have different local axes in world space?
Show answer
Roll is measured from a reference orientation that Blender derives from each bone's head-to-tail direction. If the directions differ, the reference differs, so the same angle gives a different orientation in world space.