cameras in opengl
okay, i got the basics of my 3d walkaround working....but there is one more problem.
When I press the right and left arrow keys, I simply rotate everything along the y-axis.
As you can assume this isnt the best way to turn right and left....at all....
Anybody know more about turning and stuff in 1st person view? im guessing u use cameras....i dont know how to use them though...
Just define a camera :
Whenever the player walks, change the camera (player) position accordingly, whenever he looks around, change the camera's angle accordingly.
Then, when you're going to render, make a camera (view) matrix with rotation (-vAngle.x,-vAngle.y,-vAngle.z) and translation (-vPos.x,-vPos.y,-vPos.z).
This makes sense :
When the player moves forward : The world moves backward
When the player looks right : The world rotates to his left
That's why you negate things.
Multiply this matrix by the world coordinates of any object to get aligned coordinates (coordinates in the camera space), then by the projection matrix to get the final screen coordinates.