Sub topic 12
Copy Rotation, Location, and Transforms
This chapter assumes you can add constraints to a pose bone and read the owner and target space settings from the earlier chapters. It also assumes you know basic Python in Blender. The copy constraints read one channel set (rotation, location, or the whole matrix) from a target and apply it to the owner bone. Rigs use them for control bones, mechanism bones, and FK/IK result chains.
What the Copy Constraints Do
A copy constraint has an owner (the bone that carries the constraint) and a target (an object or bone it reads from). The constraint evaluates in this order:
- It reads the target's transform in the target space.
- It keeps only the axes you enabled.
- It converts the result to the owner space and combines it with the owner's current transform using a mix mode.
- It blends that result with the previous stack result by the influence value.
The three constraints differ in what they copy.
| Constraint | Copies | Useful options |
|---|---|---|
| Copy Rotation | Rotation only | Axis toggles, invert, Euler order, mix mode |
| Copy Location | Location only | Axis toggles, invert, offset, head/tail |
| Copy Transforms | Location, rotation, and scale together | Mix mode, head/tail, remove target shear |
Copy Scale also exists and follows the same pattern. This chapter does not cover it.
Setting Up a Test Rig
The script below builds four upright bones. ctrl is the target. The other three each get one kind of copy constraint in the following sections.
import bpy
arm = bpy.data.armatures.new("CopyDemo")
rig = bpy.data.objects.new("CopyDemo", arm)
bpy.context.collection.objects.link(rig)
bpy.context.view_layer.objects.active = rig
rig.select_set(True)
bpy.ops.object.mode_set(mode='EDIT')
for name, x in (("ctrl", 0.0), ("rot_follow", 2.0), ("loc_follow", 4.0), ("tf_follow", 6.0)):
b = arm.edit_bones.new(name)
b.head = (x, 0.0, 0.0)
b.tail = (x, 0.0, 1.0)
bpy.ops.object.mode_set(mode='POSE')All four bones share the same rest orientation. This matters for the local-space settings used below.
Copy Rotation
Copy Rotation matches the owner's rotation to the target's. You can limit it to some axes, which is useful for sharing only a twist.
import math
import bpy
rig = bpy.data.objects["CopyDemo"]
bone = rig.pose.bones["rot_follow"]
con = bone.constraints.new('COPY_ROTATION')
con.target = rig
con.subtarget = "ctrl"
con.target_space = 'LOCAL'
con.owner_space = 'LOCAL'
con.euler_order = 'AUTO'
con.use_x = False
con.use_y = True # copy only rotation around the bone's long axis
con.use_z = False
con.mix_mode = 'REPLACE'
con.influence = 1.0In Blender a bone's Y axis runs along its length. Copying only Y in local space therefore copies the roll around the bone, which suits twist bones.
The mix mode decides how the copied rotation combines with the owner's own rotation:
REPLACEdiscards the owner's rotation on the copied axes.ADDadds the target's Euler angles to the owner's.BEFOREapplies the copied rotation before the owner's rotation.AFTERapplies it after the owner's rotation.
Copying individual axes works on Euler angles. Gimbal-lock effects can therefore appear when you rotate the target far from its rest orientation. If the copied value jumps, change euler_order to match the target bone's rotation mode.
Copy Location
Copy Location moves the owner so its position matches the target's. By default it snaps the owner's head to the target's head. When the target is a bone, Head/Tail slides the sampled point along the target bone from 0.0 (head) to 1.0 (tail).
import bpy
rig = bpy.data.objects["CopyDemo"]
bone = rig.pose.bones["loc_follow"]
con = bone.constraints.new('COPY_LOCATION')
con.target = rig
con.subtarget = "ctrl"
con.target_space = 'LOCAL'
con.owner_space = 'LOCAL'
con.use_offset = True # add the target's motion to the owner's own location
con.use_x = True
con.use_y = False # ignore forward/back motion
con.use_z = True
con.invert_x = True # mirror the left/right motionSeveral options are worth knowing:
- Offset adds the target's location to the owner's current location. Without it, the target's location replaces the owner's.
- Invert flips the sign of an axis. It gives you mirrored motion, such as a finger that curls opposite to its control.
- World space to World space is the default. It snaps the owner on top of the target. Local to Local gives relative motion instead.
- Copying only some axes lets you restrict a bone to a line or plane, like a slider that follows only the target's height.
Copy Transforms
Copy Transforms copies the whole matrix: location, rotation, and scale. Use it when one bone must be a faithful follower of another, such as a deform bone following a hidden mechanism bone.
import bpy
rig = bpy.data.objects["CopyDemo"]
bone = rig.pose.bones["tf_follow"]
con = bone.constraints.new('COPY_TRANSFORMS')
con.target = rig
con.subtarget = "ctrl"
con.target_space = 'WORLD'
con.owner_space = 'WORLD'
con.mix_mode = 'REPLACE'
con.head_tail = 0.0In REPLACE mode the owner's own posing is fully overwritten. The other mix modes keep the owner's pose and apply the target's transform before or after it. The BEFORE and AFTER modes each come in a FULL and a SPLIT variant. FULL combines whole matrices. SPLIT combines location, rotation, and scale separately, which avoids shear when scales are non-uniform.
Influence and Stack Position
Every copy constraint has an influence from 0.0 to 1.0. At 0.5 you get a halfway blend between the stack result before the constraint and the copied result. Because influence is an animatable property, it is how a bone fades from one behavior to another. The FK/IK chapter drives it from a custom property.
Position in the stack matters. A copy constraint sees the result of every constraint above it. If an IK constraint sits above a Copy Rotation on the same bone, the copy overrides the IK solution on the copied axes. If Copy Rotation comes first, the IK solver acts on the already-copied pose. Reordering the stack with the arrows changes the outcome, so build up one constraint at a time and test after each.
Common Problems
- The bone jumps to the wrong place. The spaces are probably World and World when you wanted Local and Local, or the reverse. Switch both spaces and watch which one gives relative motion.
- Rotation looks right on one axis only. The rest rolls differ. Align the bone rolls or use World space.
- A dependency loop appears. The target depends on the owner, either directly or through a parent. Constraints cannot read a transform that depends on their own result, so retarget or restructure the hierarchy.
- Scale looks sheared. Use Copy Transforms with a
SPLITmix mode, or enableremove_target_shear. - The constraint appears to do nothing. Check that influence is above 0, the target and sub-target are set, and a constraint above it is not overriding the result.
Exercise
A bone must copy only the twist of a control bone, which means rotation around its long axis. The two bones have the same rest orientation. Which constraint, spaces, and axes do you choose?
Show answer
Use Copy Rotation with Local target space and Local owner space. Enable only the Y axis, because Y runs along a bone's length, and disable X and Z. Set the mix mode to Replace (or Add if you want to keep the owner's own twist).
Exercise
You add Copy Transforms to a mechanism bone with World to World spaces and influence 1.0, but the bone you posed by hand no longer responds. Why, and how can you keep your manual pose?
Show answer
With the Replace mix mode, Copy Transforms overwrites the owner's pose, so manual posing has no visible effect. To keep it, change the mix mode to a Before or After variant, so the target's transform is combined with the owner's pose. You can also lower the influence.