how do i get mouse coordinate ?

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?


center mouse:,,

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:

spinning a object by moving the mouse :wink:
#drh 2007

environ = loader.loadModel(“object”)
environ.setPos (0,15,0)
environ.setScale (1,1,1)


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”)


hope that helps a bit :wink:

be sure that your mouse cursor is in the engine window by starting up, instead the programm crashs :wink: