Skip to main content
gamedev.net
🔒 Locked

Proper camera movement

Started by Shabadoo Jan 12, 2002 at 6:46 AM 0 replies 900+ views
Original Post
Shabadoo
Shabadoo
Hi all, I''ve got a problem with my camera movement. I can''t figure out how to make my camera position move properly in relation to the direction it is facing. For example, say i rotate the camera to face NW, when i try to strafe right, how do i get the camera to move NE instead of directly east? I am using a vector for the camera position and am storing the rotation in a quaternion, i can get a vector out of my quaternion telling me exactly where i am facing, i also have a velocity vector that is added to/subtracted from when the movement keys are pressed. Thanks Shabadoo
Fruny
Fruny
Since you have a "forward" vector, all you need is to do a 90° rotation to get the "side" vector.

If your are looking along a (X,Y) vector, then (Y,-X) is to your right.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.