# Separate rotations

This is a discussion on Separate rotations within the Game Programming forums, part of the General Programming Boards category; I'm writing a space game and I'm using a huge sphere centered around the player as the backdrop. A skybox ...

1. ## Separate rotations

I'm writing a space game and I'm using a huge sphere centered around the player as the backdrop. A skybox didn't quite look right so I switched to a sphere. Here is my problem.

When you fly straight up or straight down and attempt to move left or right - the craft spins. This is fine on planet earth since it is how aircraft really act. However in space this is not good. I want the craft to move left and right at any angle of rotation. In other words I don't want the x rotation mapped over the y rotation at any point in time. All rotations need to be separate. However with my current design, and no I'm not yet using quaternions, it doesn't work.

Do I need to use the matrix for rotation about an arbitrary axis for all rotations and dump the x,y,z rotational matrices?

I'm sorta stumped.

2. So you are experiencing gimbal lock. You do need to dump the x, y, z euler angles. Axis Angle will solve your problem. I would really look into using quaternions so you can smoothly interpolate the rotation orientations if you ever need to. If you do not, then you can stick with axis angles. Enjoy.

3. you could just minus the angle by what you plused it by. Do you get what I am saying or does your design not allow that?

4. you could just minus the angle by what you plused it by. Do you get what I am saying or does your design not allow that?
No amount of altering any angle will solve the issue whilst using x,y,z rotational matrices. Problem is gimbal lock. There is a point at which one axis of rotation is mapped onto another axis of rotation. This is encountered in space craft quite a bit and is known as gimbal lock.

In fact with the Apollo space program they trained rigorously on piloting the crafts because they could reach the dead band...or gimbal lock. At this point the craft had no directional control. Any rocket inputs would simply make the craft spin...not turn. But they also suffered from another type of gimbal lock in which a rotation could not be stopped because the rocket could not move to an angle sufficient enough to counteract the rotation.

I believe the shuttle overcomes these problems by having multiple thrusters at multiple angles which cause multiple x,y, and z rotations. I don't think the shuttle can gimbal lock as the old space capsules could.

EDIT:

Easily solved by adding D3DXMatrixRotationAxis.

So now my camera has 3 modes - aircraft, ground, and space.

Thanks all.

Popular pages Recent additions