Original Post
Okay I was reading the Camera5(strafing) tutorial on www.gametutorials.com And found out that I suddenly became unsure on some vector stuff, namely the center param in gluLookAt() When he is calculating the way to move forward he does this:
// Get the current view vector (the direction we are looking)
CVector3 vVector = m_vView - m_vPosition;
Where m_vPosition gets passed as eye param and m_vView as center param in gluLookAt() Now comes the part that my mind wont get, why does he have to calculate the View vector? Aint the m_vView vector the view vector? And if it's not then why are he does this ? I know my math skill in vector math is poor, so plz explain it in as plain words as possible. Entire function:
///////////////////////////////// MOVE CAMERA \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*
/////
///// This will move the camera forward or backward depending on the speed
/////
///////////////////////////////// MOVE CAMERA \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*
void CCamera::MoveCamera(float speed)
{
// Get the current view vector (the direction we are looking)
CVector3 vVector = m_vView - m_vPosition;
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *
// I snuck this change in here! We now normalize our view vector when
// moving throughout the world. This is a MUST that needs to be done.
// That way you don't move faster than you strafe, since the strafe vector
// is normalized too.
vVector = Normalize(vVector);
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *
m_vPosition.x += vVector.x * speed; // Add our acceleration to our position's X
m_vPosition.z += vVector.z * speed; // Add our acceleration to our position's Z
m_vView.x += vVector.x * speed; // Add our acceleration to our view's X
m_vView.z += vVector.z * speed; // Add our acceleration to our view's Z
}