Unlocking the mouse motion

Is there any way I could unlock the mouse motion (where mouse cursor moves the camera) without having to disable my input listeners such as the Keyboard key inputs?



I am trying to run the animation while being able to do other stuff outside Jmonkey.



Thanks

Do you mean you want to see the mouse cursor and be able to move it around, but you want to leave the flyCam’s default key bindings for camera movement?



If that’s all you want, I think you need to set the input manager’s “cursor visible” to true. From the main game class, inputManager.setCursorVisible(true);



Does that have the effect you’re looking for?

2 Likes

yup that’s exactly what I was looking for.



Thanks!

Is there a way to keep the jME game running even when the user isn’t clicked on it? Every time I click off the jME Window, the game completely stops until I click back on it. Any ideas?

app.setPauseOnLostFocus(false)?

2 Likes

morrowsend, I use Cinematics and it worked fine even if I click off the screen, I’ll look for a function that does that, must have to do with focus

Norman’s method works perfectly. Thanks again!

This doesn’t seem to work for me, the following program doesn’t unlock the mouse

[java]public class Main extends SimpleApplication {

public static void main(String[] args) {
    Main app = new Main();
    app.start();
}

@Override
public void simpleInitApp() {
    Box b = new Box(Vector3f.ZERO, 1, 1, 1);
    Geometry geom = new Geometry("Box", b);

    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.Blue);
    geom.setMaterial(mat);
    inputManager.setCursorVisible(true);
    rootNode.attachChild(geom);
}

}[/java]

flyCam.setDragToRotate(true); does unlock the mouse but obviously has the drag side effects

I think I found the solution to this, I had to disable the flycam as well, so

[java]inputManager.setCursorVisible(true);
flyCam.setEnabled(false);[/java]