# Rotating camera in 4pi.

After trying to keep track of angles to achieve a full rotation (alternativly around x or y or z axe) I fall in a lock loosing total control.

To figure out what is the goal, think to move the camera (actor point of view) using a 3 axis joystick.
Pushing/pulling forward/backward make rotation on the actor X axe.
Pushing left and right make rotation on the actor Z axe.
Rotating clockwise and counterclockwise make rotation on the actor y axe.

So that, using glulookat becomes quickly a mess :sorrow: .

The point is that:
ALL rotations are around the actor coordinate system [local system, isn’t it ?] (like in a plane), so I have to make further and further rotations.

It there must be a solution. But it is far out of my … screen
ANy help is wellcome.
Send private messages in case … OK ???

Giovanni

Hi,

I´m not absolutly sure what you are mean, but it can be that you are fall in the gimbal lock. It means that there is a case in the three dimensional room where you lost an axis. In this case you cannot different between all three axis.

http://en.wikipedia.org/wiki/Gimbal_lock

If that is your case you should use quaternions, but it is noch so easy to understand it.

TheGreen

I have seen … my way, and most strightforward, is the quaternions.
But this way don’t pay the lot of work.
I have read that there is a way using matrices…

Do someone know more about it ???

Thanks

Have a look at this:

I suggest you learn about matrices. They are hard to grasp at first, but once you understand the basics, you will love them. Quaternions are cool too, both have their uses. Use matrices for camera orientations though, they have lots of useful secondary uses, such as extracting the ‘up-vector’ and viewing direction with no added computation.

Hint: a 3x3 rotation matrix is really no more than 3 vectors: 1 pointing up, one pointing sideways, and one pointing in the forward/backward direction.
(For some reason nearly all rotation matrix tutorials fail to mention that and suggest to think of a matrix as a ‘black box’ – bad teaching!)