Sub topic 13
Damped Track, Track To, and Stretch To
This chapter assumes that you can create an armature, switch to Pose Mode, create pose-bone constraints, and understand local and world transform spaces. It also assumes that you know the difference between a target object and a target bone.
These constraints make one bone respond to another bone or object:
- Damped Track rotates a bone toward a target using the shortest rotation. It avoids the explicit up-axis setting used by Track To.
- Track To rotates a bone toward a target and also uses an up axis to control roll.
- Stretch To rotates and scales a bone so its length reaches the target.
Choosing the Tracking Constraint
| Constraint | Main result | Common use |
|---|---|---|
| Damped Track | Points one local axis at a target | Eyes, simple aiming, soft orientation |
| Track To | Points an axis at a target with controlled roll | Cameras, mechanical parts, precisely oriented bones |
| Stretch To | Points and lengthens a bone | Tentacles, cables, limbs, chains |
A tracking constraint does not move the owner bone's head. The bone rotates around its existing head. Stretch To also changes the bone's length, so it can produce unrealistic scaling if the target moves too far away.
Adding the Constraints
The following example assumes an armature named ArmRig with pose bones named head_ctrl, camera_bone, cable, and target. The target is a bone in the same armature.
import bpy
rig = bpy.data.objects["ArmRig"]
target_name = "target"
head_ctrl = rig.pose.bones["head_ctrl"]
camera_bone = rig.pose.bones["camera_bone"]
cable = rig.pose.bones["cable"]
damped = head_ctrl.constraints.new("DAMPED_TRACK")
damped.name = "Aim smoothly"
damped.target = rig
damped.subtarget = target_name
damped.track_axis = "TRACK_Y"
track_to = camera_bone.constraints.new("TRACK_TO")
track_to.name = "Aim with stable roll"
track_to.target = rig
track_to.subtarget = target_name
track_to.track_axis = "TRACK_Y"
track_to.up_axis = "UP_Z"
stretch = cable.constraints.new("STRETCH_TO")
stretch.name = "Reach target"
stretch.target = rig
stretch.subtarget = target_name
stretch.rest_length = cable.length
stretch.head_tail = 0.0The correct track_axis depends on the bone's local orientation. In a conventional Blender bone, local Y points from head to tail, but imported rigs may use another axis. If the bone points backward, select a negative tracking axis instead.
Roll, Spaces, and Constraint Order
Damped Track is convenient when the shortest rotation matters more than exact roll. Track To gives you more control, but an unsuitable up axis can cause sudden flips when the target crosses that axis.
The owner and target spaces affect how transforms are measured. A target inside a moving control rig usually behaves predictably in local or pose space. A target in another object may require world space.
Constraints execute in stack order. A Copy Rotation constraint before Track To can change the starting orientation that Track To uses. A later Limit Rotation constraint can then clamp the result. Test one constraint at a time before combining them.
Exercise
Which constraint should you choose when a bone must point at a target and change length to reach it?
Show answer
Use Stretch To. Damped Track and Track To rotate the bone but do not extend it.