Are there any programmers out there that can help me? I am writing a game that allows you to move around a 3D grid in any direction by turning to face the way you want to go (up, down, left or right) and then pressing a key to go forwards (or backwards) in that direction. I found some code online that does this but there is a problem with it - when you are looking straight up (90 degrees) and then head straight in that direction, you end up travelling at about 80 degree or so. In other words, you can never head straight up or down, only at a slope.
Here is the code… I hope someone can make some sense out of it because I can’t. I would be perfect if it wasn’t for this little problem.
Oynx probably doesnt have to do any of his own matrix calculations for this simple program. The problem might simple lie in the call to gluPerspective or glFrustrum
mX, mY, mZ: position
mPitch: angle up/down
mYaw: angle left/right
i derived these formulae from the multiplication of the x-rotation-matrix (pitch) and the y-rotation-matrix (yaw), the result multiplied with the starting eye-vector (pitch = yaw = 0): (0, 0, 1) (also looking along the positive z axis)
this might be the reason for your problem