Jump to content
  • Advertisement

Archived

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

Viper173

No Rotation issues anymore :-)

This topic is 5527 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
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!