PDA

View Full Version : Skeletal animation question



rgreene
03-18-2003, 12:21 AM
I tried posting in the advanced forum, but didn't get a response, so I'm posting this here...

Sorry for the OT posting here, but I'm trying to write a skeletal animation system in OpenGL and am running into some issues.
The system uses quats at each key for each bone to dictate how the bone should rotate. Each time I update the skeleton, I interpolate between the appropriate keys and multiply the quat by it's parent (if one exists) for the final rotation quat, which I can then convert into a matrix. The system relies on quat rotations that are relative to it's parent (obviously) and I think this is where I am going wrong. I am getting my data from a 3DSMax script. Basically the call boils down to:

(in coordsys parent MObject.Rotation)

Seems simple enough, however I wonder if Max is getting me in trouble because it is using a diffrent coord system than OpenGL is (y and z are swapped).

Anybody have any real-world experience in this area that could help me out? (Hopefully even some of you know a little bit of maxScript).

Again, sorry for this being OT, but I don't know of another body of graphics programers which are so easily accessible.


Edit: I should note that this approach has worked very well for my test cases of varying complexity, however as soon as the code is applied to a humanoid skeleton it breaks.

M/\dm/\n
03-18-2003, 03:58 AM
I don't understand why this should be OT? AnywayZ, I was working with static models in Rhino & there is an option to swap axis when saving, I guess Max shoud have smthn like that too. You can look at some matrix tutorials to understand how matrix is created, but I wouldn't recomend you changing quats as there is a lot of s**t ahead!

rgreene
03-18-2003, 09:51 AM
Well, I made the assumption that as long as Max's rotations were valid within max, it should be valid with my engine, even if y/z are swapped. I've wrote my own code to convert a node's transformation matrix into a quat and indeed what max spits out is correct...

rgreene
03-19-2003, 12:42 AM
The problem was that y/z were swapped. Just turned those around in my quat and everything works out.