• Advertisement

Archived

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

camera rotation with the mouse?

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