Jump to content
  • Advertisement
Sign in to follow this  
vraim

Quat other way.

This topic is 4323 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, In most cases everyone are using quaternion rotations to rotate the camera and this is the subject about which I found the info. I got other kind of problem. I got model and yaw, pitch, roll and I'm using this way: glRotatef( RotX, t[0],t[4],t[8]); glRotatef(-RotY, t[1],t[5],t[9]); glRotatef( RotZ, 0.0f, 0.0f, 1.0f); , where t[16] is actual projection matrix. Is there the possibility to do it on quaterions and get free of gimbal lock. How could I preapre such matrix?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by vraim
Hi,

In most cases everyone are using quaternion rotations to rotate the camera and this is the subject about which I found the info. I got other kind of problem.
I got model and yaw, pitch, roll and I'm using this way:

glRotatef( RotX, t[0],t[4],t[8]);
glRotatef(-RotY, t[1],t[5],t[9]);
glRotatef( RotZ, 0.0f, 0.0f, 1.0f);
, where t[16] is actual projection matrix.

Is there the possibility to do it on quaterions and get free of gimbal lock. How could I preapre such matrix?
1. There's nothing (fundamental at least) that you can do with quaternions that you can't do with matrices or vectors; my advice is to forget about the former until you've mastered (or at least have a solid understanding of) the latter.

2. Are you sure t[] is the projection matrix? Or did you mean modelview? (In the given context, the former really doesn't make much sense.)

3. As long as you use a series of glRotatef() calls (as in your example), your rotations may be subject to gimbal lock. The solution is not quaternions, but rather to use your own math code and update the orientation incrementally.

4. Don't assume that any rotation-related problem is 'gimbal lock'. Also, in some contexts (such as an FPS camera) gimbal lock is not a problem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!