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

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.

4 replies to this topic

### #1Claus Hansen Ries  Members

Posted 31 March 2000 - 01:05 AM

any one got a link to a VERY GOOD camera tutor ??? i have tried 5 times to make a camera...and each time something skrewed totally up.....my problem is the math, if you a at the world coordiante x, y, z and look in direction pitch, yaw, rool and you push eg. forward / strafe / or something else, it just dont move in the right direction......( my calc how a X movement of the camera, result in x,y,z movement i world coordiantes is ALLLLLWAYS wrong =) ) so right now, my camera is static at 0,0,0 and u can only turn around there =)

### #2Spellbound  Members

Posted 31 March 2000 - 02:11 AM

If you compute the orientation of the camera in matrices, you can transform the direction you want to move the camera into world coordinates.

MATRIX RotZ, RotY, RotX;
SetRotateZ(&RotZ, roll);
SetRotateX(&RotX, pitch);
SetRotateY(&RotY, yaw);

MATRIX Mtx;
Mtx = RotY * RotX * RotZ;

VECTOR Forward = {0,0,-1};
VECTOR Up = {0,1,0};
VECTOR Right = {1,0,0};

Forward = Mtx * Forward;
Up = Mtx * Up;
Right = Mtx * Right;

Now you can move the camera by adding the vectors to its position.

Posted 31 March 2000 - 03:27 PM

Hey, I got a system working, this is how I did it...

First, you must rotate the scene by your camera''s roll, pitch, and yaw.
Then, you must translate the scene by the opposite of your camera''s position. Why the opposite? When, shifting the camera to the right is kinda the same as shifting everything else to the left, and you''re working with everything else, so...There you go.

As for moving in the direction you''re facing, that''s going to take some math, trigonometry to be specific. It''s not that hard to figure out...Easier when moving in 2D than when in 3D, though.

- Hai, watashi no chichi no kuruma ga oishii deshita!
...or, in other words, "Yes, my dad's car was deliscious!"

### #4Claus Hansen Ries  Members

Posted 03 April 2000 - 07:56 PM

What can i say....ARRRRRRRRRRRRGGGGGGGGGGGGGGG

this thing with rotate and then translate ( or translate rotate )....it for a first person shooter right ???....and doesn''t work for airplane ???....if i look straight down ( -y )....the x movement og the mouse results in a roll instead for looking from -x to x of the camera

is it better to use a normal for the direction af the camera ( and a angle for roll ) ???

### #5Claus Hansen Ries  Members

Posted 03 April 2000 - 07:57 PM

...OF THE MOUSE...=)

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.