Chris Condy
Chris Condy

Reputation: 636

Quaternion rotation opengl

If i make a quaternion which represents for example a players direction and the angle around this rotation. So for the application I intend to make a plane flying. The quaternion would represent the players direction and the angle around this direction.

Then my question is how do I rotate the object in the program do I convert the players quaternion to a matrix then glMultMatrix this with this?

If this is all good can someone post if my theory is correct and if not post me a source material to read or some good theory for what I should do.

Upvotes: 0

Views: 2667

Answers (1)

Kos
Kos

Reputation: 72241

I hope I understand the question correctly.

a quaternion which represents for example a players direction and the angle around this rotation

Yes, an unit-length quaternion represents an orientation, which can be interpreted as an axis-angle pair. It's simple to make a quaternion from axis-angle.

how do I rotate the object in the program do I convert the players quaternion to a matrix then glMultMatrix this with this?

That's one way to do it, yes.

This is a good resource on the mathematics behind (both the explanation and equations):

http://content.gpwiki.org/index.php/OpenGL:Tutorials:Using_Quaternions_to_represent_rotation

Upvotes: 2

Related Questions