Original Post
hi all!
I have a problem with my rotations which I think is called "gimble lock". I found some articles about it, but no real way to solve it!
I want to rotate my camera in my own space-shooter (roll, pitch and yaw).
First I tried it like this:
roll(angle): angleZ += angle;
pitch(angle): angleY += angle;
yaw(angle): angleX += angle;
This is of course impossible cause this simply ignores the previous rotations. My solution to this works, but it''s very slow and I think there should be another way.
I don''t use 3 variables for the rotations about each axis any more, but I create a temporary rotation matrix at the time the camera gets rotated (not at the time the scene is drawn), and then I multiply this temp matrix with the previous matrix.
I''m working with opengl, so instead of using glRotatef(...) before drawing the scene, I''m loading my previously calculated own matrix with glLoadMatrix.
This way, the rotation is right, but I don''t think this is a good way. It would be much better, if there were a way to calculate the right 3 angles for roll/pitch/yaw and to use glRotate(...) before drawing the scene. It should also be much faster, I think.
Does anyone have another solution for this?
thank you
Philippo
s_buschmann@gmx.de
http://privat.schlund.de/Gerio
s_buschmann@gmx.de
http://privat.schlund.de/Gerio