AbsoluteMouse in JME 3.0

Hi all,

I was wondering why AbsoluteMouse (from the input package) was removed in JME 3.0? Is there an equivalent for handling mouse pointers? Disabling the flycam frees the mouse, however is there a way to use both? Or will I need to implement my own camera?

Thanks :slight_smile:

jME3 isn’t based on jME2 (it was written from scratch, with some parts copied from jME2). So AbsoluteMouse is not there because it was not added, not because it was removed.

To answer your question, you can try setting flyCam.setDragToRotate(true), this allows you to have the mouse, but still support the fly camera.

1 Like


Actually, another question: How do I extract the mouse pointer coordinates? Under JME 2.0 I could use AbsoluteMouse. However since AbsoluteMouse doesn’t exist, what would be the equivalent?

The way I’ve been doing that is by:


mouseInput.setInputListener(new RawInputListener() { …

And now you have to implement what you want the various RawInputListener methods override. So for example, if you just want the mouse pointer to report it’s position when it moves:


public void onMouseMotionEvent(MouseMotionEvent event) {

Vector2f mouseCoords = new Vector2f(event.getX(), event.getY());

System.out.println(mouseCoords.x + ", " + mouseCoords.y);


…should do the trick. If you wanted to grab the coordinates and do something when the mouse is clicked, then you’d do something similar in the onMouseButtonEvent. If you’re just concerned with the mouse, just leave the method contructors for the KeyEvent and JoyEvents empty, and implement the Mouse ones as you see fit.

This is by no means gospel though, just the way I’ve been doing it.

1 Like

That’s exactly what I was looking for. – I must have missed setInputListener – been tearing my hair out looking at the javadoc…and here it is! Thanks :slight_smile: