It seems like, before the user has moved the mouse, calls to InputManager.getCursorPosition() return (0,0) at the coordinate even, if that is not the location that the mouse is actually at. What’s the best way to tell the difference between a real 0,0 position and a fake due to the mouse having not yet been moved?
EDIT: Seems to particularly be the case if JMonkeyEngine is in windowed mode and the cursor has not entered the window area yet.
I edited to clarify: I am not reacting to a mouse move event. I just want something to follow the cursor, whether or not the mouse has moved yet. IE. I don’t want it to go to 0,0 if the mouse cursor isn’t at 0,0.
EDIT: And if it’s not at 0,0, I want to know where it actually is.
Why don’t you initialize your listener, including a boolean value. Initially as you say, the mouse will be 0,0. So while it’s in that position, the value is false, so don’t add your follower. When it stops being 0,0 - change the boolean value to true - and thus your follower will be added.
Other than that, paul is speaking sense. I presume your problem is that your follower is stuck at 0,0 and looks silly until the mouse has actually moved.
You could also check the position of the mouse vs the extremeties of the window, and if they match, remove the follower (or preferably set the cullhint to avoid continually adding and removing a simple node.