Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Prosper/LOADED

Quaternions/Euler (not the usual question)

This topic is 5985 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

I''ve recently discovered the evil gimbal lock and a way to avoid it : quaternions. The problem I have is that in order to work properly, quaternions have to be built in an incremental way. If I do : (case A) - convert Euler angles to quaternions - convert convert quaternions to matrix It doesn''t work, so I do this : (case B) - take the last object''s quaternion, - multiply it by the "additionnal rotation" - get the new matrix. This work fine if the object''s rotation is created based on the last one. But now, how can I avoid gimbal lock if the user "set" the three Euler angles. Let''s say the user have some kind of form, fill it with the three new Euler angles to apply to the object. The last object''s quaternion is just useless and I''m stuck with the case A. Does anyone know a solution to this problem ?

Share this post


Link to post
Share on other sites
Advertisement
You should define a set of coordinate axes for each object. Then allow the user to set Euler angles for rotation about these axes. Then you can convert these Euler angles into a quaternion, which can be done where the order of the angles doesn''t matter. Finally, convert the axis of this quaternion into the space defined by the local coordinate axes of the object and you will have a new quaternion that can be used to rotate the object.

Share this post


Link to post
Share on other sites
One more thing, when you rotate the object with the new quaternion, also rotate its local axes so you can repeat the whole process with a set of new Euler angles.

Share this post


Link to post
Share on other sites
quote:
Original post by gtdelarosa
Finally, convert the axis of this quaternion into the space defined by the local coordinate axes of the object...



Sorry for being stupid but how must I do this ?

Share this post


Link to post
Share on other sites

  • 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!