Jump to content
  • Advertisement

Archived

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

Helicon56

Camera question

This topic is 5863 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, this is a simple question: i''m creating a camera class, and everything works reasonably well, except the pitch rotation. when the pitch of the camera gets above 90 degrees, it starts to come back down, instead of continuing up, and the other way round for -90. I use this to calculate the Y value of the lookat point: m_vLookatPt.y = y + (g_tTrig->GetSinValue(m_fPitch)); gtTrig is just something for trig lookup tables. So i know why it''s happening - because as the rotation goes from 0 to 90, sin(rotation) is going from 0 to 1, but above 90, the sine starts going back down to -1. So the camera just keeps on going up and down. So can anyone tell me how to make it so it''ll rotate all the way around? Thanks alot.

Share this post


Link to post
Share on other sites
Advertisement
I''m no expert, but if you are just use glRotate, then you can only go 360 degrees in one or two of your axes. If you want better rotation, you have to do something fancier. Everyone always says to use quaternions. You certainly have to do some matrix math to get over this problem.

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.

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

Sign me up!