Position information in spacework...

mykeh13

29-03-2009 02:02:45

Hi...

It is possible to make the render window draw a little information on the screen saying the camera's actual position...

For example : this is how game starts, note the camera's position is wrong....



-----------------------------------------------------------------------------------

And this is the correct orientation...



while window render appear on the screen, we are able to move it with mouse buttons and wheel... the question is if i move the camera in game and adjust to fit image 2, how can i know the exact coordinates of that position to put in code?.
so, when start the next time, will be like instantly like image 2...

Thank you..

bharling

29-03-2009 20:34:20

lots of ways to do this, the simplest way is to just print the camera position in the framelistener on frameStarted, or bind a key in the framelistener:



def _processUnbufferedKeyInput(self, frameEvent):
if self.Keyboard.isKeyDown(OIS.KC_K) and self.timeUntilNextToggle <= 0:
print self.camera.getPosition()
self.timeUntilNextToggle = 1.0
return sf.FrameListener._processUnbufferedKeyInput(self, frameEvent)


Or create your own debug overlay ( or modify the default one )

mykeh13

29-03-2009 22:43:53

I see... the code works fine.. that way is easiest.

thanks !