Creating an OpenGL FPS camera: I have the position and orientation vectors, now what?
Posted
by
Synthetix
on Game Development
See other posts from Game Development
or by Synthetix
Published on 2012-07-10T08:54:08Z
Indexed on
2012/07/10
9:22 UTC
Read the original article
Hit count: 188
I have been struggling to create a first person camera in OpenGL ES 2.0 without using gluLookAt(). I grab the camera's orientation vectors (the way it's looking) from the current modelview matrix, and use that to calculate the new forward/backward (Z) translation value. I then calculate the strafe (X) value from the dot product of Z and Y (which is always 1.0). So, I have all the information I need to create a view matrix, but how do I do that without using gluLookAt? Almost all the examples I've seen use gluLookAt, but no such function exists in OpenGL ES 2.0. Besides, one of the moderators on cprogramming.com mentioned that gluLookAt is not appropriate for FPS cameras:
I am really confused by all the conflicting information I'm getting. I just want to create a first person camera that goes forward (W,S keys), side-to-side (A,D keys) and rotates around its center (Y axis only), Wolfenstein style.
Any help on this would be much appreciated!
© Game Development or respective owner