How come mouse cursor goes to (0,0) upon first move?

Hi all,



Put simply - game starts out fine, with the cursor at the middle of the screen as it was instructed to be,

but upon the tiniest move… it goes to (0,0).

It happens in my code, but also when I run the tutorials' HelloMousePick.java



Any idea why ?

I've narrowed down the problem a bit - the statement



am.setLocalTranslation(new Vector3f(display.getWidth()/2, display.getHeight()/2, 0));



where 'am' is my AbsoluteMouse object, doesn't seem to have a lasting affect -

it moves the cursor to the middle of the scree alright, but the mouse events triggered by mouse movements "remember" the original position, i.e. (0,0).



Any tips how to overcome that?

Thanks.

Which version of jme are you using?

I'm with version 3

When you are using jme3 with your application extending SimpleApplication the error could be that you are using the default FlybyCamera.



FlyByCamera has the function 



public void onAction(String name, boolean value, float tpf) {

        if (!enabled)

            return;



        if (name.equals("FLYCAM_RotateDrag") && dragToRotate){

            canRotate = value;

            inputManager.setCursorVisible(!value);

        }

    }



which changes the visibility of the mousecursor. Switching visibility off and on again causes the mouse to reappear in the center of the screen.

bloodcell said:

I'm with version 3

Probably not. jME3 does not have the class HelloMousePick, AbsoluteMouse, or the variable "display", which you mentioned.
I am guessing this is version 2.