Panda3D Manual: Mouse Support
<<prev | top | next>> |
Panda3D has mouse support built in. The default action of the mouse is to control the camera. If you want to disable this functionality you can use the command:
base.disableMouse()
This function's name is slightly misleading. It only disables the task that drives the camera around, it doesn't disable the mouse itself. You can still get the position of the mouse, as well as the mouse clicks. To get the position:
if base.mouseWatcherNode.hasMouse(): x=base.mouseWatcherNode.getMouseX() y=base.mouseWatcherNode.getMouseY()
The mouse clicks generate "events." To understand what events are, and how to process them, you will need to read the Event Handling section. The names of the events generated are:
mouse1 | Mouse Button 1 Pressed
mouse2 | Mouse Button 2 Pressed
mouse3 | Mouse Button 3 Pressed
mouse1-up | Mouse Button 1 Released
mouse2-up | Mouse Button 2 Released
mouse3-up | Mouse Button 3 Released
If you want to hide the mouse cursor, you want the line: "cursor hidden #t" in your Config.prc or this section of code:
props = WindowProperties() props.setCursorHidden(1) base.win.requestProperties(props)
<<prev | top | next>> |