Mouse moving question

Hello :wink:

I’m using base.mouseWatcherNode.getMouse() to get the position of my mouse with getX() and getY() .
All works good until I reach the value 1 which apparently is the max. So I’d like to reset that value to zero when the max is reached but there is no setX() function defined and couldn’t find any.

Is there a solution for that ?
Thanks in advance

First of all, resetting the mouse to 0 every frame is not such a good practice - it is better to set the mouse to relative mode. However, not every operating system implements that well.

This is how you can reset the mouse to the middle of the window:

base.win.movePointer(0, base.win.getXSize() / 2,
                        base.win.getYSize() / 2)

Indeed pro-soft, base.win.movePointer stuff doesn’t work on Mac… I realize that when I studied the normal-Mapping tutorial.

I must use an other way…

Right, you’ll need to use the MRelative mouse mode.

Ok… :confused: (didn’t found much info except your discussion with drwr where I don’t understand everything).
What will happen to a code like this one:

if base.mouseWatcherNode.hasMouse():
   mpos = base.mouseWatcherNode.getMouse() 
   mousePosX = mpos.getX() 

If I use it, must I re-write functions according to each OS ?

Hm, relative mouse mode should work on OSX and Windows, and as of the latest CVS version of Panda (and >1.7.0 of course) it should also work on other unixes.

Sorry to come back with this but I’m still not able to make it work.
I used this for declaring my world:

base.disableMouse()
WindowProperties().setCursorHidden
WindowProperties().setMouseMode(WindowProperties.MRelative)

I’m in fullscreen by default but when I reach the screen’s border, not able to scroll more!

Can you specify which platform you are on?

I am on Mac.

Hrm… I don’t have a Mac myself. Please file a bug report with working and small sample code at bugs.launchpad.net/panda3d/ and give instructions how to reproduce the bug. Just so that the bug doesn’t get lost in the forums.

Wow… I didn’t think that I was going to face a bug in Panda at my level!

But is it really a bug ? I’m still seeing my mouse anyway. Not the real mouse but a bigger and “uglier” one…

Uh, that’s what I (maybe too quickly) assumed. Can you describe the bug maybe a bit better, and perhaps show a screenshot?

No, you were right… It’s well a bug.
I found other users on Mac facing the exact same issue.
Added a comment and waiting for resolution.

Thanks for everything pro-soft :wink: