Game Development Community

Quaternion and Rotation Animation

by Jendrik Posche · in Torque Game Engine · 06/10/2008 (5:24 am) · 1 replies

Hi All,

I have a question about the usage of the quaternions in the torque engine.

I want an object to rotate to a certain orientation and animate that rotation over time.

The custom object has the processtick/interpolatetick/advancetime functions.

Now my question is, how do I hook this animation.

1. Convert my transform matrix to a quaternion
2. Create a quaternion from a matrix?
3. Do i use the quaternion interpolate() or the slerp() to interpolate between the two quaternions
4. Convert the new quaternion to a new transform matrix
5. Copy over this transform matrix to the real transform matrix

Am I on the right track? How do I take the position of the object into account? Suppose I want to do this rotation twice, do I need to multiply my target quaternion with some thing before I interpolate it?

Regards,

#1
06/10/2008 (9:44 pm)
The Item class has already a rotation function.
It is a good idea to check it out.