Jump to content
  • Advertisement

Archived

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

Great Milenko

Quaternion & Camera Problems

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

after running into gimbel lock with euler angles I went throught the trouble of implementing quaternions. now my camera is having more problems than with eulers. whats happening is when I first start out with no rotations my pitch seems to be dead (no movement at all) but yaw & roll work fine. if I roll 180deg then everything works as expected, I get the same result if I yaw 180deg. angles inbetween on roll both pitch & yaw give the same result, diagonal movement. if I yaw between 0 and 180deg pitch sorta works other than it has roll in it (diffrent yaw angles give diffrent amounts of roll). I''ve checked my code serveral times against the tutorials and I''ve already searched for possable fixes to this but so far no luck. its a fairly large amount of code so heres a short version of what I''m doing: check input for change (using euler angles) build temp quaternion repersenting change NewCoords = Change * Old build new matrix from NewCoords am I off here or any ideas about where I should look?

Share this post


Link to post
Share on other sites
Advertisement

Are you taking into account that quaternions work with 0-180 degrees? When going past 180 degrees you invert the axis of rotation.

eg rotation around Z axis.

degrees quaternion[x,y,z,w].
157.50 Q[ 0.19454771, 0. , 0. , 0.98089306]
202.50 Q[-0.19298524, 0. , 0. , 0.98120166]

Also instead of change, maybe you should do:
NewCoords = quat_from_euler(new coords)

Good luck!

Share this post


Link to post
Share on other sites
when you say rotating past 180 degrees do you mean "total rotation" or change? if its total then yes but I''m having alot of problems still befoce I get to 180

it was my understanding that if I didn''t build a temp quat then multiply it with a "running" quat that it would still result in gimbal lock. I''m I understanding wrong?

Share this post


Link to post
Share on other sites

''It was my understanding that if I didn''t build a temp quat then multiply it with a "running" quat that it would still result in gimbal lock. ''

Don''t think so. Shouldn''t be too hard to test.

Here''s a good resource about quaternions:

http://www.cs.ualberta.ca/~andreas/math/matrfaq_1.04.html

Share this post


Link to post
Share on other sites
heh hummmm well ok I'm a dumbass =) I decided to go through my quaternion code (for like the 10th time) and I found a few errors in it I missed =) (a subtract where there should of been an add... a few other minor errors along those lines)

anyways thanx for you help. (and the link) =)

[edited by - Great Milenko on June 29, 2002 10:49:43 PM]

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!