Roland Everaert wrote:
> Making the ship rotate is not the problem, actually I am usingthe
> following code to define the rotation:
> def __chasingView(self, planex, planey, planez, pitch, heading, roll):
> glRotatef(roll, 0.0, 0.0, 1.0)
> glRotatef(heading, 0.0, 1.0, 0.0)
> glRotatef(pitch, 1.0, 0.0, 0.0)
> glTranslate(-planex, -planey, -planez)
If this roll, heading, pitch representation works for your game and all
you want to do is finding the "forward" direction in which the ship is
supposed to move, then you have to apply the above rotations to the
vector (0,0,1) (which is the forward direction as seen in the ship's
local coordinate system).
You can either use a mat3 or quat for that, you just have to make sure
you apply the rotations in the same order as OpenGL does (as an exercise
you might try replacing your three calls to glRotate() with one call to
glMultMatrix() and construct the rotation matrix yourself).
> I think that my biggest problem is my lack in math which prevent me from
> understanding the logic involved. If you have any book recommandation,
> it is welcomed.
I can't recommend a particular book. I suppose you could just pick any
book that's about (3D) game development. Maybe you can find some
suggestions on http://www.gamedev.net.
- Matthias -