@Override
  public void onAction(String name, boolean keyPressed, float tpf) {
    //toggling rotation on or off
    if (name.equals("toggleRotate") && keyPressed) {
      rotate = true;
      inputManager.setCursorVisible(false);
    }
    if (name.equals("toggleRotate") && !keyPressed) {
      rotate = false;
      inputManager.setCursorVisible(true);
    }

  }
A 3rd-person camera node follows a target (teapot).  Follow the teapot with
WASD keys, rotate by dragging the mouse.
jme3-examples/src/main/java/jme3test/input/TestCameraNode.java