Thanks for the example and the explanation, I will have a look at it
Le 08/03/10 17:01, Mike C. Fletcher a écrit :
On 10-08-02 04:57 PM, Roland Everaert wrote:
The problem you are facing is that you want to make the motion of the
ship (x,y,z) modify by currentrotation * motionvector. You *could* do
that with an ever-increasing set of glRotate/glTranslate calls (you'd
need one for every change in direction), but what you really want to do
is to track your position in "world" space and change that position by
currentrotationmatrix * motionvector.
I am currently writing a third person view space shooter where the
player can freely fly in the "map". I want to define an arcade flying
model like in most space shooter or spaceship simulation, but I face the
problem of specifying the transformation right.
For the moment, my scene contains the player space ship pointing toward
the negative z axis, with the camera a little bit behind it. In front of
the ship there are 2 objects. When I apply some thrust to the player
spaceship it goes forward, but if I turn the ship, it is not changing
direction, while the ship and the camera are turning.
My questions are the following:
1. Given the code below, why have I to call the method
self.__chasingView() after rendering the player's ship?
2. How to change the direction of the ship? Am I missing some glRotate()
functions somewhere in the code or should I change the code of method
setNewPosition() in such a way that the position of the ship is computed
on all 3 axis?
I normally do that with a wrapped Quaternion class in OpenGLContext.
See OpenGLContext/move/viewplatform.py for the code that wraps it
(particularly the relativePosition() method, on which all of the
various forward/sideways/up/down movements are built.
that should be something like self.addToPosition( self.thrust *
self.tick * self.orientation )
self.addToPosition(z=-(self.thrust * self.tick))
Mike C. Fletcher
Designer, VR Plumber, Coder
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
PyOpenGL-Users mailing list