I’ve been getting started using Panda and so far everything has been working great!
I’d like to use a trackball though, and I was wondering if anyone has a suggestion on how to do this. Specifically, I’d like to get the raw mouse movements, versus the location of the mouse pointer within the screen.
An example of this would be a golfing type of game (think Golden Tee or similar). For that type of game to work, I think I need to be able to see mouse motion even if the pointer is maxed out at the top of the screen.
I’ve looked through the manual, references, and forums, but I’ve only seen the ability to get the mouse pointer with reference to the window.
Does anyone have any suggestions? Any help would be greatly appreciated.
I don’t know how one might get the raw mouse movements, but another option might be to simply “warp” the mouse cursor to the centre of the window on each update, after taking its current offset from the centre to give you your input. I’ve used it for such things as first-person-perspective mouse-look controls, as I recall.
This code is taken from one of my projects, and should give you an idea of how to do this (there may be better ways, of course):
mouse_x = 0
mouse_y = 0
#First check that it's safe to work
# with the pointer
#capture the mouse x- and y- coordinates
mouse_x = base.mouseWatcherNode.getMouseX()
mouse_y = base.mouseWatcherNode.getMouseY()
#In this case I use the mouse
# x-coordinate to turn the player
#If it's safe to do so, warp the cursor
# back to the screen centre.
base.win.movePointer(0, base.win.getXSize()/2, base.win.getYSize()/2)
Thanks for the quick reply. This worked for me, thanks much!
It’s my pleasure - I’m glad that it works for you.