cod999

03-16-2015, 01:27 PM

Now I have a forward vector for the camera (0,0,-1). I'm rotating it around global x-axis for 2 degrees, and use the transformed vector for glm's lookAt function. But when running, it doesn't just stop at the positive 2 degrees around x-axis, instead it continues to rotate upward. While using the same method for another object, the object only rotate for that amount of degrees as expected. Why using it for the camera's forward vector will constantly rotate it?

mat4 rotation;

rotation = glm::rotate(2.0f, vec3(1,0,0));

forwardVector = mat3(rotation)* forwardVector;

viewMatrix = lookAt(eye, eye+forwardVector, vec3(0,1,0));

mat4 rotation;

rotation = glm::rotate(2.0f, vec3(1,0,0));

forwardVector = mat3(rotation)* forwardVector;

viewMatrix = lookAt(eye, eye+forwardVector, vec3(0,1,0));