Skip to main content
GameDev.net gamedev.net
🔒 Locked

FPS type view

Started by Axesor Jan 31, 2006 at 9:01 PM 1 replies 800+ views
Original Post
Axesor
Axesor
I have been having trouble with getting my views to work >_< I have input, graphics, and everything but the darned view! I am using gluLookAt. Can anyone help me create a view look a First Person Shooter? I cannot sem to get much help on this topic. Thanks! ~Axesor
.::WARNING!::. Axesor is a total newb or n00b! Beware his lack ofintellegence of OpenGL. Feel sorry for him and keep him in your thoughts.~Leader of the phsychoward
Zakwayda
Zakwayda
This has been discussed recently in math and physics, so you might look through the last couple pages or so of threads there. In short, gluLookAt() isn't a particularly good choice for an FPS-style camera. All you really need is two angles (yaw and pitch), and a position vector. You then set up your view matrix like this:
glMatrixMode(GL_MODELVIEW);glLoadIdentity();glRotatef(-pitch, 1, 0, 0); // Or whatever axis is to the side for youglRotatef(-yaw, 0, 1, 0); // Or whatever axis is up for youglTranslatef(-pos.x, -pos.y, -pos.z);
You can calculate your forward and side movement vectors using the sine and cosine of your yaw angle. If you need the forward aim vector, you can query the modelview matrix, or construct it yourself using trig.
Axesor
Axesor
Thanks. I will look into the physics section then.
.::WARNING!::. Axesor is a total newb or n00b! Beware his lack ofintellegence of OpenGL. Feel sorry for him and keep him in your thoughts.~Leader of the phsychoward

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.