I start with this pose:
Notice that each bone is one unit long, and is that length along its own local Y. Were these bones not bent like this, it would just be a long line of one unit long bones, always extending along their local Y axis.
I rotated the bones, as shown in the picture, so one of the bones is rotated 90 degrees along Z. Then I rotate the next one to be -90 degrees along Z.
So… if I were to output the rotation of each bone now, in bonespace, they should all be zero, except there should be a 90 in there, followed by a -90.
However, the rotations of the bones (in bonse space) is output as
zero zero zero zero zero zero… never anything except zero, using the code:
for bone in arm.getBones():
mymat = element[3].getRestMatrix('bonespace')
RotMat = mymat.rotationPart()
Quatty = RotMat.toQuat()
objectdatalist.append(Quatty.axis[0])
objectdatalist.append(Quatty.axis[1])
objectdatalist.append(Quatty.axis[2])
objectdatalist.append(Quatty.angle)
print objectdatalist
The result is a zero rotation on all the bones, always.
Interestingly enough, the bones that are rotated are showing it as a translation along X in bone space - I don’t see how this is possible. As you can see on the picture, clearly, the bone has been rotated, not translated.
Am I missing something here, or is this a bug in Blender? I’m busy writing some serious export tools for a game project, and I have to get these things 100 percent correct. I need the positions and rotations of these bones, in bone space, and I figured that asking for the matrix, in bone space, would supply this…
Note that at the time of writing, if I ask it for the bone’s ‘quat’ instead of using the matrix method, I can get the correct rotation (90 degrees), but the position is messed up by such a rotation, as I mentioned above, so its still useless…