• ### What is your GameDev Story?

#### Archived

This topic is now archived and is closed to further replies.

This topic is 6782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a space ship rotation problem if someone think they can help me... Mail me and I send you the code... what I am Trying to do i a space ship simulator whit "realistic" controls .... i can''t Get the Rotation to work properly... Please Help... /* joho_iamqwerty@hotmail.com */

##### Share on other sites
what kind of rotation are you trying to do....
is it DirectX or....
does your graphics device support rotation ?

##### Share on other sites
Is this in 2D or 3D?

##### Share on other sites

Plane camera, opengl

- WitchLord

##### Share on other sites
what axis are you rotating around?

JoeMont001@aol.com

##### Share on other sites
If its 2d rotation, look at my game, http://arkia.tripod.com. It is a 2d space game and it does rotation.

For a good time hit Alt-F4! Go ahead try it, all the cool people are doing it.

##### Share on other sites
The problem with using angles for each axis to rotate a ship is commonly known. No matter what order you rotate in, the second rotation will be relative to the first, and the third relative to the first and second. The first rotation is always relative the world axis. I think the solution is to use quanterions, but I don''t know anything about them.

##### Share on other sites
Enybody know enything about quanterions?????

Need it for 3D rotations...

##### Share on other sites
Its not too hard.
just forget about the 4th row in the vector - keep it 1.
In OpenGl the current Modelview Matrix is applied to the verticies like that:

v'' = M * v (v={x,y,z,1})

so, to solve your problem you have to apply the Rotation R from the _left_ side:

v" = R * M * v

Then you will rotate in ''screen'' coordinates.
If you use glRotate/glTranslate it would be like that:

v"= M * R * v

which means, that you are rotating in the local system :-(

I solved the problem like that:
I implemented a CMatrix class which holds an float[16] Matrix and some memberfunctions to create the rotation matricies and the matrix multiplications.
In my application i start with an identity matrix and then modify it for each rotation.
Before calling the Rendering functions i load my own rotation matrix...

...long enough for here...

Syn

##### Share on other sites
i forgot my email...

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 11
• 15
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
634151
• Total Posts
3015825
×