camera rotation with the mouse?
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.
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement