Disable ThirdPerson-View to get Mouse-Cursor

Hi!



I have a problem with the third-person-view: I'm trying to create a third-person-view at

a model, to be able to cycle the camera around it. But I only want to cycle the camera

with the mouse, when a mouse-button is pressed. If not, I want to get an normal cursor

to click on things. I got it worked that I can cycle around the model with the mouse, but

not the disabling if no button is pressed. Here my code:


public class CommanderMouseInput extends ThirdPersonHandler {
   
   private GameControlManager manager;
   private GameControl leftButton;
   private GameControl rightButton;
   private ChaseCamera chaseCamera;
   
   private IngameState ingameState;
   private MotherShip motherShip;
   
   public CommanderMouseInput(MotherShip motherShip, Camera cam, IngameState ingameState, HashMap<String, Object> props) {
      super(motherShip, cam, props);
      this.motherShip = motherShip;
      this.ingameState = ingameState;
      manager = new GameControlManager();
      initChaseCamera();
      setMouseBindings();
      setMouseAction();
      
      setRotateOnly(true);
   }
   
   private void initChaseCamera() {
      chaseCamera = new ChaseCamera(camera, motherShip);
      chaseCamera.setMinDistance(150);
      chaseCamera.setMaxDistance(200);
      chaseCamera.getMouseLook().setRotateTarget(false);
      chaseCamera.setActionSpeed(0.1f);
   }
   
   private void setMouseBindings() {   
      rightButton = manager.addControl("Right Button Pushed");
      rightButton.addBinding(new MouseButtonBinding(MouseButtonBinding.RIGHT_BUTTON));
      leftButton = manager.addControl("Left Button Pushed");
      leftButton.addBinding(new MouseButtonBinding(MouseButtonBinding.LEFT_BUTTON));
   }
   
   private void setMouseAction() {
      ActionController stopMouse = new ActionController(rightButton, new GameControlAction() {
         public void released(GameControl control, float time) {
            setLookingEnabled(false);
         }
         public void pressed(GameControl control, float time) {
            setLookingEnabled(true);
         }
       });
      ingameState.getRootNode().addController(stopMouse);
   }
   
   @Override
   public void setLookingEnabled(boolean enable) {
      chaseCamera.getMouseLook().setEnabled(enable);
   }
   
   public ChaseCamera getChaseCamera() { return chaseCamera; }

Found a solution. Know only handling with a chaseCamera and no thirdPerson-thingy.

It's really much easier now… :smiley: