How do you keep the PoseBone's rotations generated with IK Solver

Hi guys,

I have a rather strange problem here. I setup an armature to follow an object using the IK solver. I move the object being followed at each IPO frame, and at each frame, I also record the rotations of all the bones in the armature using the following code:

pose_bones[bName].insertKey(armObj, currentFrame, [Blender.Object.Pose.ROT])

(of course I call makeEditable and pose.update() before and after the insertKey function calls)

Everything works – until I remove the object that was being followed by the IK solver. As soon as I remove the object from the IK solver constraint, all my previous rotations just disappear!!! This is rather strange. Would someone have an explanation for this?

Thanks a lot.


Sorry for keep posting the same question, but I’m really stuck here. I thought I had the answer but it seems that I’m wrong. Here is what I’ve found: if you use the IK solver constraint on a chain of armature bone, the quat member of the Posebone does not get updated at each IPO frame at all. Therefore, even if I insert a key use the pose_bone.insertKey method at each IPO frame, I still wouldn’t be able to save the rotations of the bones caused by the IK solver. This then leads me with 3 things:

(1) The raw locations of the pose_bone.head and pose_bone.tail

(2) pose_bone.localMatrix at each frame

(3) pose_bone.poseMatrix at each frame

Now, the first option would require me to manually calculate the quat of each bone done the chain – this is just too bloody hard espeically since the the entire armature could have gone through a ton of transformations and everyone of those needs to be reversed.

The second option seems reasonable, as the localMatrix is supposed to give you the local rotation, translation and size of that particular pose_bone, so I thought that if I could get the rotation part of the matrix, and set the quat of the pose_bone from that matrix, I’d be fine – but this doesn’t work either!! The localMatrix of the pose_bone actually is the worldspace matrix of the pose_bone – or something else, the quats I got from the local Matrix are just wrong.

The last option seems reasonable too, as the poseMatrix is supposed to contain everything including the constraints themselves … but this doesn’t work either!! The quats I got from the rotation part of the poseMatrix are totally wrong as well.

So, guys, any ideas please?

Thanks a lot.