Jump to content
  • Advertisement

Archived

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

rpg_code_master

camera rotation with the mouse?

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

Hey, I have a camera rotation with mouse algorithem that isn''t that great, hrer it is float y = pMouse->GetMouseControls( ).XRel / 1000.0f; float x = pMouse->GetMouseControls( ).YRel / 1000.0f; m_fCurrentRot -= x; if ( m_fCurrentRot > 1.0f ) m_fCurrentRot = 1.0f; else if ( m_CurrentRot < -1.0f ) m_fCurrentRot = -1.0f; else { CVector3 vec = Cross( m_vecDir - m_vecPos, m_vecUP ); vec.Normalize( ); Rotate( -x, -vec.GetX( ), -vec.GetY( ), -vec.GetZ( ) ); Rotate( -y, 0.0f, 1.0f, 0.0f ); } // end else ( yes, it''s moded from gametutorials.com ) This alogorithem doesn''t allow total 360deg rotation. I once had one that did alow complete 360deg rotation. Can anybody please tel me of one. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by rpg_code_master
m_fCurrentRot -= x;
if ( m_fCurrentRot > 1.0f )
m_fCurrentRot = 1.0f;
else
if ( m_CurrentRot < -1.0f )
m_fCurrentRot = -1.0f;



there is your 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.

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!