How to use glLookat for navigation?

How do I use glLookat to navigate around a maze?

If I try and move forward (with the up key)from my origin, I can change the x,y of the camera position to increment in the forward direction and it is fine.

However, if I am facing back to the origin and I hit the same key, I move backwards because the I am still incrementing in a forward direction.

How do I fix this?

On a 3D maze you need all three axis for movement.

x = left/right
y = up/down
z = forward/backwards.

You need to have a direction variable to indicate which way is forward for your object. Just remember the changing the view does not change how things are moved in the world.
If you are telling the computer to move the object north, just rotating the object does not mean that it now will start to moving south when you tell it north.

example code, to give an idea of how to movie forward:

if(ARROW_KEY_UP == key_press)
{
move_x = cos(direction);
move_z = sin(direction);
}

Originally posted by UnderWear:
[b]How do I use glLookat to navigate around a maze?

If I try and move forward (with the up key)from my origin, I can change the x,y of the camera position to increment in the forward direction and it is fine.

However, if I am facing back to the origin and I hit the same key, I move backwards because the I am still incrementing in a forward direction.

How do I fix this?[/b]

[This message has been edited by nexusone (edited 11-21-2002).]

[This message has been edited by nexusone (edited 11-21-2002).]