Question

I am implementing a camera class and am getting stuck with some things

Let's suppose the camera is at Point (0,0,0) looking at a certain direction with its corresponding UP and RIGHT vectors.

I have a joystick control which allows you to go forward-backwards, or change orientation by moving (left-right) or (up-down), according to the above mentioned vectors.

How can I know, given the 3 vectors, which is the resulting direction vector if for instance I want to move N degrees right??

Was it helpful?

Solution

If you are talking about rotating your camera, here is how it is done: every rotation is a matrix that transforms coordinates, so all you have to do is to calculate the matrix of your rotation and then apply it to Dir, Up and Right vectors of your camera to get new ones after rotation is done.

Here is a little reading about rotation matrices (read the section of 3D rotations): http://mathworld.wolfram.com/RotationMatrix.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top