Archived

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

No Rotation issues anymore :-)

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

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 on other sites
See this

http://www.gamedev.net/community/forums/topic.asp?whichpage=1&pagesize=20&topic_id=153283

1. 1
2. 2
Rutin
25
3. 3
4. 4
5. 5

• 9
• 13
• 19
• 14
• 9
• Forum Statistics

• Total Topics
632940
• Total Posts
3009328
• Who's Online (See full list)

There are no registered users currently online

×