Realistic motion (turning left and right) question...

Hi,
How hard is it to turn left and right on a 3d plane? (Is it a simple call, or 2 dozen factors to modify and keep track of?) Let me try and clarify my problem…I have created a very simple 3d world(a floor and a building) I can use glrotate(), but it rotates my entire scene about the oigin(which is nice to look at but not what i need) I can use translate (but that just moves me side to side) how hard would it be to turn left and right(not shift left and right) and maintain that my up key on the keyboard continuously moves me in the direction im facing(right now it moves toward the origin)? If you know how to do this (and it involves pushmatrix, popmatrix modelview) please try and explain it simple(I’m still FAR from learning how to use these things effectivly…A code snippet would be very usefull)Thanx so much in advance…

bh9158@wcu.edu

Trigonometry!!! You have to remember, going forward isn’t just going on one axis, it is actually a vector. so you have to take into account the angles of rotation.

Do it on paper, you’ll see it is very simple.

Do something like this pseudo:

if (key == LEFT) angle += 0.1;
if (key == RIGHT) angle -= 0.1;
if (key == UP){
Xpos += SPEED * cos(angle);
Zpos += SPEED * sin(angle);
}
if (key == DOWN){
Xpos -= SPEED * cos(angle);
Zpos -= SPEED * sin(angle);
}