FlyByCamera's setEnabled() method

Hi,



I’m looking to switch my camera between enabled and disabled mode when the application is running. The most logical place to do this is to use the setEnabled method in FlyByCamera:



[java]

/**

  • @param enable If false, the camera will ignore input.

    */

    public void setEnabled(boolean enable){

    if (enabled && !enable){

    if (!dragToRotate || (dragToRotate && canRotate)){

    inputManager.setCursorVisible(true);

    }

    }

    enabled = enable;

    }

    [/java]



    The problem that I am having is that when I switch from a disabled camera back to enabled, the mouse is not grabbed. This is because the code above does not take into account when a camera is set from disabled back to enabled. Could we can add another condition as follows:



    [java]

    /**
  • @param enable If false, the camera will ignore input.

    */

    public void setEnabled(boolean enable){

    if (enabled && !enable){

    if (!dragToRotate || (dragToRotate && canRotate)){

    inputManager.setCursorVisible(true);

    }

    } else if (!enabled && enable) {

    inputManager.setCursorVisible(false);

    }

    enabled = enable;

    }

    [/java]