Archived

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

Helicon56

Camera question

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