Hello.
Here is a short presentation of my class.
class CCamFirstPerson
{
protected :
CVector m_Right,
m_Up,
m_View
public :
// constructor, destructor…// Rotate cam around X axis void RotationX( float Angle ) { } // Rotate cam around Y axis void RotationY( float Angle ) { } ...
}
Here is my problem, I’m unable to well apply the rotation on each vector to get a right FirstPerson camera. When I look down and I rotate left/right, the camera doesn’t keep the view vector on (0.0, 0.0, 1.0), so it’s make an effect like a 6DOF camera.
So to try another thing, I decided to work without my vector. Just take the Angle and set up a matrix with it. The inconveniant of that : I can get the vector inside the final matrix, but they will not be updated into the rotation function… So not very practical…
Ex :
void RotationX( float Angle ) { m_Pitch += m_Pitch - Angle; } void UpdateCam() { // Create rotation matrix CMatrix MatRotY; MatRotY.CreateRotationY(m_Yaw); CMatrix MatRotX; MatRotX.CreateRotationX(m_Pitch); CMatrix MatRot = MatRotY * MatRotX; // Create Translation Matrix CMatrix MatTrans; MatTrans.CreateTranslation( -m_Pos.X, -m_Pos.Y, -m_Pos.Z );
// Create the final matrix CMatrix MatCam = MatRot * MatTrans;
// Update de modelview matrix glMatrixMode( GL_MODELVIEW ); glLoadIdentity; glLoadMatrixf( &MatCam ); }
This method works well but I don’t want to use it and you know why… I want to apply the rotation directly on the vector, into the rotation function. Anyone could help me ?
[This message has been edited by Erakis (edited 10-17-2002).]