I'm trying to experiment with IK on my skinned animations and although I wrote the code, I haven't looked at it in a while and I'm slightly confused by something. What I'm trying to do at the moment as a first step is find the vector between where I want my foot position to be and the thigh joint. This means I need to compute where the pelvis joint is in world space.
My animations are converted and exported in from a COLLADA document (not at runtime) that I have exported from a 3d art package. What I've suddenly become confused about (I don't speak the language of Matrices very well) is what the matrices of the animations for each bone represent. I'm pretty sure I'm doing it the standard way:
Starting from the root bone, I iterate though its children and multiply up the animation matrix with its parent's animation matrix - I call this the world matrix at each level. Then at each level, I multiply the world matrix by the inverse bind matrix and call that the working matrix. This gives me a full pose of working matrices that I pass to my shader - this all works nicely.
So if I wanted to find the position of any joint in world space (or even object space would do at the moment), how would I do that? I thought I could simply multliply up the animation matrices to the level I wanted and that would be that, but when I do that and place a box marker that that point, it's nowhere near the joint on the model. In fact, if I place several boxes at the root, pelvis, lower spine, right thigh, right calf, they all seem to be heading along the x direction with a similar height, not as I expected.
I then tried multiplying each level by the inverse bind matrix (after multiplying by the parent's animation matrix - as per my normal skinning method) and, again, they don't end up in the right positions.
Am I missing something? Do the translation parts of the animation matrices not contain the joint positions (iteratively)?
Thanks for any help