When you drive a pose bone's location, you're actually driving its local, rather than global location (I guess that's true for any location, but still worth mentioning).

I've been trying to find the easiest way to drive the global location. I already know I can find the global location using either of these methods:

armature.matrix_world * pb.matrix * pb.location

So I thought that I'll write a custom driver function that will find the global location and drive the local location values according to a converting back from global-to-local.

But I can't seem to convert the global value back to the original local value. I tried:

armature.matrix_world.inverted() * pb.matrix.inverted() * globalLoc

And just:

pb.matrix.inverted() * globalLoc

But I could not get that original local value back. Since the order of these mutliplications is important, I tried to re-order the multiplicated variables in any arrangement possible but no luck.

I'm open to other methods for achieving this or any suggestions on how to solve it this way.


1 Answer 1


I already know I can find the global location using either of these methods:

Both will not give you the correct global matrix. The first lacks the armature object transformation and the second is twice multiplying the pose_bone location - it's in pb.matrix already. So the way to get global location is:

pbone_global_loc = (armature.matrix_world * pbone.matrix).to_translation()

And the way to get the pbone matrix back is:

pbone.matrix = armature.matrix_world.inverted() * pbone_global_loc

If the pbone_global_loc is 3x3 make it 4x4 with:


  • $\begingroup$ Eventually the solution to getting back the local from the global location was using the inverted compound matrix: (armature.matrix_world * pbone.matrix).inverted() * globalLoc $\endgroup$
    – TLousky
    Nov 15, 2015 at 9:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .