Game Development Community

Rotation Interpolation

by Dylan Sale · in Torque Game Engine · 11/24/2003 (1:20 am) · 6 replies

How would I do it? I am integrating ODE into torque, and am simulating the system on the server, then sending the transforms to the clients. I was going to then interpolate the transforms to get the clients animation smooth, but i dont know how ;) I can do position easy, but the rotation is screwing me over.

Would I use the matrix, or should I somehow extract the axis rotations out of the matrix (if so how?).

I would appreciate any links or references to material, ive looked up a bit, but cant seem to find anything useful.

Thanks. Dylan

#1
11/24/2003 (1:21 am)
Arg, dont worry, i just found out that there is an interpolate method :S lol, i had an idea to look at the vehicle code as I was typing that last post out :S.
#2
11/24/2003 (3:48 am)
Good to know your doing well with ODE!
maybe you could help me with this:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4348
*sorry,but you seem to know what your doing*
#3
11/24/2003 (6:24 am)
Not as well as I thought :( I cant get the interpolation right.. no matter how much I try, it always ends up doing random rotations and junk.. Maybe its because i know absolutely nothing about quaternions ;)

Any ideas why it would be doing this? The animation is smooth (ie position interpolation), but I cant get the rotation working...

Ah well, you guys probably cant help without looking at the source.. if you want it, come and claim it ;) me email is in my profile (i think :| )
#4
11/24/2003 (6:57 am)
Vehicle does interpolation of everything... take a look there.
#5
11/24/2003 (6:58 am)
Yep, I tried to copy it as much as possible, but I must have missed something (I had to change a lot as well). Maybe if I revert back and try it again..
#6
01/02/2004 (9:18 pm)
I know this thread is probably dead but I found a question I can answer...slerp

(given two matrices startMat and finishMat and a percent from 0.0f to 1.0f..)
QuatF startQuat(startMat);
QuatF finishQuat(finishMat);
QuatF interpQuat = startQuat.slerp(finishQuat,percent);

interpQuat.setMatrix(destinationTransform);

// probably followed by a:
destinationTransform.setColumn(3,interpolatedPosition);

I always keep the starting and ending rotations in QuatF's to start with so I'm not sure
exactly how well converting back and forth does...

-Pascal