View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# "Camera" Help

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1YodaTheCoder  Members

Posted 20 October 2001 - 04:30 PM

Okay, its just working... I''ve got a floor.. I''ve got functions that move forward, move back (those seem to work), but the rotate doesnt correspond to the movements!!!! I know how the whole Rotatef and Translated work; You set up your axis, and if you move your figure (in my case, my floor (which is a polygon)) it will rotate or translate according to its respective axis.. How do I override that? I want where ever I stand (its First Person) to be the center of the x-y-z axis. Is that possible? If not, how do I make it so i can move around my little polygon? The only way that seems logical is to make wherever I stand the point of origon for everything.. Any of that maake sense? I hope so.. ~Jesse PS does it involve gluLookAt?

### #2TerranFury  Members

Posted 21 October 2001 - 01:08 PM

You want to translate according to the negative player.x, player.y, and player.z, and you want to rotate according to -player.rotation. You just need to do your rotations and translations in the right order. Rotate and then translate before drawing your scene.

You can use gluLookAt to achieve the same effects.

Also, if you want the player to move foward relative to his rotation, you need to use some simple trig. In case you didn''t already know, that''s the following:

x += sin(angle) * speed;
y += cos(angle) * speed;

(you may need to switch the sine and cosine depending on how your coordinates are set up)

Also, remember that glRotate takes angles in degree measure, while sine and cosine take angles in radian measure, so you''ll need to convert between the two. Remember the following:

A trick to compute PI quickly, easily, and painlessly, is the following:

PI = atan(1) * 4

That should be all you need to know, unless you want to use gluLookAt, in which case I can''t help you since I''ve never even looked at the prototype for that function. I''ve just overheard what it''s supposed to do!

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.