Sub topic 10
IK Limits and Locks on Individual Bones
This chapter covers the per-bone IK settings in Blender: locks and limits, plus the stiffness values that sit next to them. They shape how the IK solver spreads rotation across a chain. It assumes you can add an IK constraint with a target and chain length (previous chapters), switch between Edit and Pose Mode, and read a short Python script. The scripted examples use the two-bone ArmRig from earlier in the tutorial.
Why per-bone settings exist
An IK constraint on the last bone of a chain asks the solver for a pose. By default the solver may rotate every bone in the chain freely on all three axes. A real elbow is closer to a hinge, so the unrestricted result can look wrong. Typical symptoms are a forearm that twists around its own length, or an elbow that bends backwards.
Blender gives you two tools for this:
- IK locks and limits are stored on each pose bone. Only the IK solver reads them, and the solver takes them into account while it searches for a solution.
- Limit Rotation constraints are ordinary bone constraints. They clamp the final pose after the solver has run, whatever moved the bone.
The difference between these two tools is the main idea of this chapter.
The settings on a pose bone
In Pose Mode, select a bone and open the Bone tab in the Properties editor. The Inverse Kinematics panel has these controls for each axis (X, Y, Z):
| Setting | Python property | Effect |
|---|---|---|
| Lock | `lock_ik_x`, `lock_ik_y`, `lock_ik_z` | The solver may not rotate the bone on this axis. |
| Limit | `use_ik_limit_x` and the Y and Z equivalents | Turns on a range for the axis. |
| Min / Max | `ik_min_x`, `ik_max_x`, and so on | The allowed rotation range, in radians in Python. |
| Stiffness | `ik_stiffness_x`, `ik_stiffness_y`, `ik_stiffness_z` | Resistance to rotation on this axis, from 0 to 0.99. |
| Stretch | `ik_stretch` | How much the bone may stretch when the target is out of reach. |
The axes are the bone's local axes. In Pose Mode, set the transform orientation to Local or turn on Axes in the bone display options to see them. The local Y axis runs along the bone, so rotation around Y is a twist. Rotation around X and Z is a bend.
Making an elbow a hinge
Here is the hinge setup from the Topic Spine examples. It locks Y and Z and limits X to a range of 0 to 150 degrees.
import math
import bpy
rig = bpy.data.objects["ArmRig"]
forearm = rig.pose.bones["forearm"]
# Make the elbow a hinge that only bends on its local X axis, between 0 and 150 degrees.
forearm.lock_ik_y = True
forearm.lock_ik_z = True
forearm.use_ik_limit_x = True
forearm.ik_min_x = 0.0
forearm.ik_max_x = math.radians(150.0)Python angles are in radians, so convert with math.radians. The UI shows degrees.
Whether the bend happens on X depends on how the bone was built. If the bone's roll is different, the hinge axis may be Z. Test by rotating the bone by hand and watching which axis changes. Then lock the other two.
Locks versus limits
A lock is a limit with a range of zero, but the solver treats it more efficiently. Choose by intent:
- Use a lock when the joint must never move on that axis, such as the twist of an elbow.
- Use a limit when the joint moves on that axis but only within a range, such as the bend of an elbow.
Locks and limits affect only the IK solver. If you rotate the bone yourself in Pose Mode with no IK influence, you can still rotate it past the limit. The solver does not stop you.
Stiffness
Stiffness makes a joint resist the solver. A stiffness of 0 means no resistance. Values near 0.99 mean the bone barely rotates on that axis. Stiffness is useful on a spine chain or a tail, where you want most of the bend to occur in some bones and less in others. It does not set a hard stop, so use limits when you need a boundary.
Solver limits versus Limit Rotation
The next example adds a Limit Rotation constraint to the same bone.
import math
import bpy
rig = bpy.data.objects["ArmRig"]
forearm = rig.pose.bones["forearm"]
limit = forearm.constraints.new('LIMIT_ROTATION')
limit.owner_space = 'LOCAL'
limit.use_limit_x = True
limit.min_x = 0.0
limit.max_x = math.radians(150.0)
limit.use_limit_y = True # min and max default to 0, so Y and Z are held at zero
limit.use_limit_z = TrueThe two approaches behave differently:
| Question | IK limits and locks | Limit Rotation constraint |
|---|---|---|
| Who reads it? | The IK solver only | The constraint stack, for any source of motion |
| When is it applied? | During the IK solve | After the constraint above it in the stack |
| Does it stop manual FK posing? | No | Yes, the final pose is clamped |
| Does the solver know about it? | Yes, so the chain finds a valid pose | No, the solver ignores it |
The last row matters. If you rely only on Limit Rotation, the solver may compute an illegal pose and the constraint then clips it. The result can be a foot or hand that no longer reaches the target, because the clamp changed the chain after the solve. With IK limits, the solver searches for the best pose inside the allowed range, so the end of the chain tends to land closer to the target.
For a rig that animators will pose in both FK and IK, use both. Set IK limits so the solver behaves well, and add a Limit Rotation constraint so FK posing stays inside the same range. Use the same numbers in both places.
Edge cases and common errors
- Lock on the wrong axis. If the elbow will not bend at all, you probably locked the bend axis. Check which local axis the bend uses.
- Limit with min greater than max. Blender does not make the range sensible for you. Keep min at or below max.
- Straight chain with limits. A chain that is perfectly straight has no clear bend direction. The solver can pick an unpredictable axis. The slight bend in the example upper arm, set at construction time, avoids this. Build a small bend into the rest pose.
- Limits that exclude the rest pose. If the rest pose is outside the limits, the bone jumps when IK is enabled. Make sure the range includes the rotation the bone has at rest.
- Limit applied on the wrong bone. The per-bone IK settings must be on the bones inside the chain. The IK constraint sits on the last bone, but a limit on that bone affects only that bone.
- Locked twist and a pole target. If you lock Y, the pole angle can no longer fix a bend direction by twisting the chain. Adjust the pole angle and the pole target position first, then lock.
- Overly strict limits. If the target is unreachable within the limits, the chain stops short of it. Widen the limits, or move the target closer.
Checking your setup
- Enter Pose Mode and select the IK target bone.
- Move it through the full range the hand should reach.
- Watch that the elbow bends only on its hinge axis and never passes the limits.
- Move the target beyond reach and confirm that the chain straightens instead of twisting.
Exercise
An animator sets the arm to FK and rotates the forearm 200 degrees at the elbow, even though IK limits cap the elbow at 150 degrees. Why does this happen, and what is the fix?
Show answer
IK limits are read only by the IK solver, so they do not restrict manual FK rotation. The fix is to add a Limit Rotation constraint on the forearm, with owner space set to Local and X limited to 0 to 150 degrees. That clamps the final pose from any source.
Exercise
You want a hinge elbow that bends only around local X. Which IK lock properties do you set, and what does leaving useiklimit_x off do?
Show answer
Set lockiky and lockikz to True. If useiklimit_x stays off, the elbow can still bend on X, but with no range, so it may bend backwards past the straight position.