I posted a topic earlier about skeletal animation, but have narrowed most of it down to 1 problem - Translations!!
Currently in my code, I can Rotate and Translate joints. The problem is, when it comes time to "Reset" the animation, the translations totally mess up.
My code works like this:
As a command, either Rotate or Translate happens to a given joint, that joint's orientation matrix(4x4) is multiplied by either a rotation or translation matrix. At the end of the animation, I run through all the commands in reverse, and apply to the joint the reverse of what it was (so if it was translate (10, 10, 10), when in reverse it'll create a translation matrix (4x4) with the translation portion of (-10, -10, -10). This all works fine if all I deal with are rotations. However, the reverse translations get all wonky.
So, for example, I say Rotate frm 1, Translate in frm 2 (span 2 frames), Rotate in frm 3 to Joint1 -- Now I've multiplied joint1's orientation by the Rotate, Translate, Rotate at the end of the animation and it's in the right spot. But, when I reverse this, I multiply Rotate, Translate, Rotate (matrices) all together and then apply to the joint, and boom, it's messed up.
I have a feeling the problem lies in that the translate happened over 2 frames (so it translated for 1 frame with whatever rotation was applied in frame 1, and then in the 3rd frame it kept translating while a rotation command was applied)...
Can anyone give me any help here with translations in skeletal animation, or the "right way" to do things like this?