Sub topic 11
Bone Constraints in Blender
Prerequisites and working model
This chapter assumes that you can create an armature, parent bones, and switch between Object, Edit, and Pose Mode. A bone constraint is a rule that controls a pose bone. Instead of setting every rotation by hand, you can make a bone copy another rotation, point toward a target, or stay within a rotation limit.
Constraints affect the current pose. They do not change the armature's rest pose. Blender evaluates constraints after the bone's normal location, rotation, and scale have been calculated.
Adding and adjusting a constraint
Select an armature, enter Pose Mode, and select a bone. Open the Bone Constraints tab in the Properties editor. Add a constraint such as:
- Copy Rotation makes one bone follow another bone's rotation.
- Copy Location follows a target's position.
- Track To aims a bone axis at a target.
- Limit Rotation restricts how far a bone can rotate.
- Child Of makes a bone follow an object or bone as if it were parented.
- Inverse Kinematics solves a chain so its end reaches a target.
Most constraints have a target field. The target can be an object, an armature, or a specific bone inside an armature. The Influence value controls how strongly the constraint affects the result. An influence of 0 disables the effect. An influence of 1 applies the full effect. Keyframing influence lets you blend between controlled and manually posed motion.
Constraints are evaluated from top to bottom in the constraint list. Moving a constraint can therefore change the result. For example, a rotation limit placed before a copy-rotation constraint may produce a different pose than the same limit placed afterward.
A constraint with Python
This script creates a two-bone chain and adds an IK constraint to its child. The target empty controls the chain. The next chapter examines IK behavior in more detail.
import bpy
arm_data = bpy.data.armatures.new("ConstraintArmature")
arm_obj = bpy.data.objects.new("ConstraintRig", arm_data)
bpy.context.collection.objects.link(arm_obj)
bpy.context.view_layer.objects.active = arm_obj
arm_obj.select_set(True)
bpy.ops.object.mode_set(mode="EDIT")
root = arm_data.edit_bones.new("root")
root.head = (0, 0, 0)
root.tail = (0, 0, 1)
child = arm_data.edit_bones.new("child")
child.head = root.tail
child.tail = (0, 0, 2)
child.parent = root
child.use_connect = True
bpy.ops.object.mode_set(mode="POSE")
target = bpy.data.objects.new("IK_Target", None)
target.location = (1, 0, 2)
bpy.context.collection.objects.link(target)
constraint = arm_obj.pose.bones["child"].constraints.new("IK")
constraint.target = target
constraint.chain_count = 2Common errors
If a constraint appears to do nothing, check these items:
- The target field points to the intended object or bone.
- The armature is in Pose Mode.
- The constraint influence is greater than zero.
- The target and constrained bone use the expected coordinate space.
- The constraint order does not conflict with another constraint.
- Bone axes and roll are consistent, especially for tracking constraints.
Exercise
Why can moving a constraint lower in the list change the final pose?
Show answer
Blender evaluates constraints in order, so an earlier constraint changes the transform that the later constraint receives.