1st person camera, "free view" style


NameError: global name 'BitMask32' is not defined

sorry stupid previous post please ignore…

however when I run this code nothing happens, panda loads as if its the scene graph example http://www.panda3d.org/manual/index.php/Loading_the_Grassy_Scenery

There is an error in first code snippet; put

from panda3d.core import *

at the top, then save it as a file called FirstPersonCamera.py
Save the second snippet as testfsp.py into the same directory and execute

ppython testfsp.py

To toggle FirstPersonCamera on/off, press .

I was able to get consultit’s example working. It works nicely. :slight_smile: The example runner code needs a couple of additions, however. The camera needs to be activated, using its start() method. Because the example also takes control of the mouse once it does run, the example needs to allow release of the mouse or a game exit option.

I added:

        self.accept("tab", self.mouseLook.start)
        self.accept("escape", self.mouseLook.stop)

Add it below this line, in the TestCamera example:

        self.mouseLook = FirstPersonCamera(self, self.cam, self.render)

This thread has been very helpful, as I learn how to use Panda. Thank you. :slight_smile: