Extending FlyByCam

I’m extending FlyByCam and overriding a few of the features, namely the button used in the drag to rotate feature and what happens on a zoom action. Redirecting the zoom commands to moveCamera works find but I’m having some trouble with remapping the button for FLYCAM_RotateDrag. If I set it to middle mouse button it functions correctly, but the rotateCamera function is being called even when the button isn’t being pressed.

Anything obvious I’m missing?


public class CustomFlyByCamera extends FlyByCamera{

public CustomFlyByCamera(Camera cam){




public void registerWithInput(InputManager inputManager){



this.inputManager.addMapping(“FLYCAM_RotateDrag”, new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE));

this.inputManager.addListener(this, “FLYCAM_RotateDrag”);



protected void zoomCamera(float value){

// Override the zoomCamera method to redirect to moving the camera forward

moveCamera(value, false);




Yes, that’s because rotateCamera() does the checks if the camera should rotate. It looks at the canRotate boolean and if its false, it will exit early

Then it seems that canRotate isn’t being updated properly, let me see what I come up with

Fixed… I had to explicitly remove the oringinal flyCam instance before assigning my custom implementation.