Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


"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.

  • You cannot reply to this topic
1 reply to this topic

#1 YodaTheCoder   Members   -  Reputation: 122

Like
Likes
Like

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?

Sponsor:

#2 TerranFury   Members   -  Reputation: 142

Like
Likes
Like

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:

1 degree = PI/180 radians

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.



PARTNERS