Archived

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

No Rotation issues anymore :-)

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

As described in my last post(s) I had serious problems with Ratations. I simply wanted to rotate a starship about its own 3 axis, but even by using Quaternions I didn''t get rid of the problem. The y axis always seamed to be messed up. Now here''s the code that made it work: //* Position the spectator gluLookAt( Player.Spectator.X, Player.Spectator.Y, Player.Spectator.Z, Player.Spectator.X + V[1], Player.Spectator.Y + V[2], Player.Spectator.Z + V[3], 0,1,0); //* V is viewing vector //* drawing the ship glPushMatrix; glGetFloatv(GL_MODELVIEW_MATRIX, @m); m := invertMatrix(m); ///* ????? glLoadIdentity; //* get angle, axis from Quaternion method to represent all //* three angles of the ship''s rotation glRotatef(angle, axis[1], axis[2], axis[3]); glGetFloatv(GL_MODELVIEW_MATRIX, @Model.matrices[0]); ///* ??? Model.matrices[0] := MultiplyMatrix(m, Model.matrices[0]); glPopMatrix; glPushMatrix; glTranslatef(Position.X, Position.Y, Position.Z); //* rotate Model according to Model.Matrix[0] Model.Rotate; Model.DrawModel(); glPopMatrix; Here''s my question: Why do I have to multiply the object''s rotation matrix with the inverted ''World Matrix''? Why cant I simply use the unchanged Model.matrices[0] matrix as it is? I started from glLoadIdentity anyway....

Share this post


Link to post
Share on other sites