# What is relation between edit_bone roll and and pose.bone rotation_quaternion?

I have two slightly different rigs (two armatures from different sources) and trying to transfer rotations between corresponding bones, from one armature to another (retarget current pose at some degree). Everything is fine except one thing - some bones has different rolls in edit mode, and simple cloning of rotation_quaternion shifts final positions.

The quiestion is: How i can account for roll difference, when applying rotation_quaternion from donor bone to target one? I don`t wish to reset roll on target bones, instead i with to recalculate quaternion for different roll, so target roll will stay the same, but quaternion will account for the difference instead. Imho this is possible, since rotation_quaternion is able to completely define bone rotation, but... how? How i can translate quaternion from one bone-local coordinate system to another?

I already tryed to calculate something like this: "donor rotation_quaternion" - "donor roll" + "target roll" to get "target rotation_quaternion". For example i tryed to create "donor roll" - "target roll" rotation matrix and apply it to rotate quaternion around target bone Z axis (to undo roll difference), but no luck.

So... How roll is applyed to final bone orientation? Is there the way to remove/undo it from rotation_quaternion?

Any help really appreciated

• After some digging into Blender sources i started to think this is not possible (to overcome bone roll via rotation quaternion). Armature deformation math can be found here (just one of blender fork around the net): searchcode.com/file/131130197/blender/source/blender/blenkernel/… And it looks like Rest Matrices are calculated in slightly "separate tree" from pose matrices, so there is no direct way to "undo" roll part of the equation. Because roll affect rest matrices of child bones completely by itself, in "logical paralel" with pose calculation :(
– IPv6
Aug 11, 2017 at 11:40