Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Blender 2.6 API, PoseBone is used for animating a bone. PoseBone.matrix is one way to do that. API says PoseBone.matrix is in "object space".

PoseBone.matrix is nothing I've seen at all. I still can't get my animation importer working. What's the deal with PoseBone.matrix? In Blender 2.4 API there were two matrices: one in local space, one in armature space.

But the new PoseBone.matrix is neither! It's not a local matrix:

enter image description here

Position isn't local, it's global.

But rotation enter image description here

<Euler (x=1.5708, y=-0.7854, z=-0.0000), order='XYZ'> 


So what is this "object space" that the API says PoseBone.matrix is in?

I'm trying to assign my armature-space matrices to a hierarchial armature and I can't get them right.

I tried decomposing the matrices I have, undoing parent rotations then recomposing the matrix again before setting it as "PoseBone.matrix". It just doesn't work.

oldmatrix = myMatrix
loc, rot, scale = oldmatrix.decompose()

#rot = rot * pose.bones[bonename].parent.rotation_quaternion.conjugated()
for i in pose.bones[bonename].parent_recursive:
   rot = rot * i.conjugated()

newmatrix = rot.to_matrix().to_4x4()

newmatrix[0][3] = loc.x
newmatrix[1][3] = loc.y
newmatrix[2][3] = loc.z

pose.bones[bonename].matrix = newmatrix 
share|improve this question

closed as unclear what you're asking by Josh Petrie Dec 18 '14 at 17:25

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Isn't it 'local' to the root of the model? – Roy T. Aug 20 '12 at 9:05
If it's relative to the "root", isn't that what you call "global space". If position is relative to root, why isn't rotation? This is very unusual. Also, what do you mean by "model"? – user17402 Aug 20 '12 at 9:55
I mean to the primary bone of the model – Roy T. Aug 20 '12 at 11:05
No, that aint what local space means here. That's not even what global space means, in case you're mixing these. – user17402 Aug 20 '12 at 15:55