PDA

View Full Version : Complex rotations in worldspace



Micke
01-01-2001, 01:22 PM
Hi GL coders.
I have a big problem with a little project im working on.
I have a rocket placed at a launchpad and a camera that is attached to the rocket and rotated around it using the moiuse .
The camera always faces the rocket . Quite standard approach I think.

So first I set the camera , translates the camera zoom factor and draw the rocket .
I aslo added some inputs with the cursor kays so you can rotate the rocket .
All rocket rotations is done by using matrices and all this works fine.

After drawing the rocket I draw the launch pad and after the launchpad I draw some smoke and some rocket flames that comes out of the rocket .

All this works fine until the rocket takes off . As the camera is attached to the rocket the world is translated after drawing the rocket . So I used a separate translation matrix for the rocket that I multiply with the rotation matrix for rocket , I dont want to translate the rocket rotation matrix , right .
After that I pull out the 12,13 and 14 element of the resulting matrix and use those values to translate the ground and launchpad . Really smart , I thougnt .
The problem is that now the world rotates around the rocket instead of being translated according to the rocket direction .
I hope someone could help me with this one .
Maybe I done something totally wrong here , Ive only used GL for two months now.
( Im a former Direct3D user , and my own opininon is that Direct3D SUCKS! )

Micke!
http://www.opengl.org/discussion_boards/ubb/cool.gif
( Couldnt resist in using one of those )