PDA

View Full Version : changing viewpoint



jenny
08-13-2002, 04:25 PM
How do I change the viewpoint, in order to walk around my world, by the directions left, right, foreward, backward, up, down? Depending on where on is in the world, left isn't always a negitive y movement.

Jenny

Jambolo
08-13-2002, 06:08 PM
As long as you rotate before you translate, left is always along the negative Y axis.

jenny
08-13-2002, 10:05 PM
is there a way to do it with gluLookAt? or a way to do it with vector math? Or a way to do it that isn't dependant on if i rotate first? I'm adding this stuff to an already existing program, so i'd prefer to have to place as few restrictions on the other code as I can.

I was hoping that i could store an eye-position, and a camera-position, and allow the user movement and rotation controls and manipulate the model matrix from there. Since I want to store the change from the initial state to the current state, I think it would be easier to store the total change, rather then a summation of all the changes so far . .. . .

Or am I making this harder on myself then it really is???

[This message has been edited by jenny (edited 08-13-2002).]

[This message has been edited by jenny (edited 08-13-2002).]

satan
08-14-2002, 12:43 AM
Originally posted by jenny:
is there a way to do it with gluLookAt? or a way to do it with vector math?

I am using gluLookAt for all my different types of cameras and it is really easy. Since gluLookAt takes an eye-vector, center-of-scene-vector and an up-vector as input, you just have to manipulate these vectors the way you want them using ordinary vector math. It is helpfull to use a right-(or left) vector, too, so that you can easily calculate a new up-vector as the crossproduct of the view-vector and the right vector.

hope this helps


[This message has been edited by satan (edited 08-14-2002).]

jenny
08-15-2002, 08:36 PM
Thanks for the suggestions . . .after many changes to my code, I'm going with the rotate and translate method . . .