anyone know please post
Okay guys I’m in the middle of developing my FPS camera Code and I’m SO CLOSE I can taste it!
I have 1 problem though, is there a way to confine the mouse to the render window or to reset the position of the mouse every frame?
yes…
center mouse:
base.win.movePointer(0, base.win.getXSize()/2, base.win.getYSize()/2)
Hey cool thanks. So I don’t have to ask stupid questions like this again where can I find all the info on base.everything? I can’t find any of it in the manual or the API.
The base builtin is an instance of the ShowBase class, which you can find here:
panda3d.org/apiref.php?page=ShowBase
spinning a object by moving the mouse
#drh 2007
environ = loader.loadModel(“object”)
environ.reparentTo(camera)
environ.setPos (0,15,0)
environ.setScale (1,1,1)
base.disableMouse()
def rotate(task):
mx = base.mouseWatcherNode.getMouseX()
my = base.mouseWatcherNode.getMouseY()
dis = mx * 2
dis2= my * 2
time = task.time * 2
angledegrees = time* 6.0 * mx
angledegrees1 = time* 6.0 * my
angleradians = angledegrees * (math.pi / 180.0)
environ.setHpr(angledegrees,-angledegrees1, 0)
print mx
print my
return Task.cont
taskMgr.add(rotate, “rotate”)
run()
hope that helps a bit
be sure that your mouse cursor is in the engine window by starting up, instead the programm crashs
greetz
dirk