Jump to content
  • Advertisement
Sign in to follow this  
McFury

Quaternion rotation issue (sometimes take longest path)

This topic is 3158 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, I'm currently using quaternions (with slerp) to rotate my camera to selected positions around a simple textured sphere. It works for most of the sphere, however, sometimes when I click very specific positions it will go in the complete opposite direction to arrive at the point I clicked. To put it into perspective, lets say the sphere represented the earth. If the camera is on west australia and I click near New Zealand I would expect it to travel across australia to get there, but it will sometimes leg it across the indian ocean, circle the globe in the opposite direction and reach New Zealand from the other side. I can put up some code if needed, but is this a common issue that has a generic solution? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Negate (don't invert) one of the quaternions and do it again.
@The OP: Just to elaborate a bit, you can determine in advance whether the negation is necessary by checking the dot product of the input quaternions; if the dot product is negative, negate one of the quaternions before applying the interpolation.

[Edit: Maybe Sneftel was trying to lead you towards arriving at that yourself - if so, my bad.]

[Edited by - jyk on October 27, 2009 8:24:38 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
[Edit: Maybe Sneftel was trying to lead you towards arriving at that yourself - if so, my bad.]

Yes, how dare you interrupt my Socratic paradigm!

Nah, I just had a brain hiccup, and neglected to realize that maybe McFury doesn't want to slerp just this one time. I can't imagine how someone would come to the dot product solution on their own without a fairly deep understanding of quaternions.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!