D3DXQuaternionSlerp

D3DXQuaternionSlerp

Post by J.D. » Tue, 01 Jul 2003 19:17:18



Hi,
I was trying lately to make a smooth animation of
rotating an object. I tried doing it with quaternions but
something went wrong. I wanted to rotate an object to
face another object. I built the look-at matrix using
D3DXMatrixLookAtLH, from the point i wanted the object to
face to, then i transformed it and the current world
matrix of the object (using D3DXFunction
D3DXQuaternionRotationMatrix) to start(the current
matrix) and end(the look-at matrix) quaternions. I also
set time say 5000 ms for full rotation and using 1.0f as
the complete rotation(the parameter t in the
D3DXQuaternionSlerp function) i devided it by the time
and have the koeficient by which i have to go in the
interpolation every frame (current koeficient =
koeficientPerMS * MSPassed). The object didn't rotate
though. It just very strangely trembled. I tried to play
with the time but nothing nice happened. Am i doing it
the wrong way as an algorithm or i have used the
functions worng?
Thanks in advance.