Chase Camera - Disable Rotation


I am currently using a Chase Camera for the smooth camera animation to follow my character, however I want to disable rotation of the camera. In other words, I want the camera to ALWAYS be looking at the player geometry, and I want the camera to ALWAYS be X units behind and X units above the camera.

I figured the easy way to make this happen and still have a smooth camera is by disabling rotation of the camera, but I can’t seem to find how to do this. I tried chaseCam.setDragToRotate(false); but this only makes it so you don’t need to hold the mouse button down to rotate. I also tried setting to the rotation speed to 0, but this seemed to be simply ignored.

What is the best way to achieve the effect I am looking for?


you sure CameraNode wouldn’t be better?

If you want to disable user rotation, then delete these mappings, which can be found in the ChaseCamera source file:

[java] protected final static String ChaseCamDown = “ChaseCamDown”;

protected final static String ChaseCamUp = “ChaseCamUp”;

protected final static String ChaseCamZoomIn = “ChaseCamZoomIn”;

protected final static String ChaseCamZoomOut = “ChaseCamZoomOut”;

protected final static String ChaseCamMoveLeft = “ChaseCamMoveLeft”;

protected final static String ChaseCamMoveRight = “ChaseCamMoveRight”;

protected final static String ChaseCamToggleRotate = “ChaseCamToggleRotate”;[/java]

sucks for you that they are protected so to do the first one, you would do:


then repeat for all the others

1 Like


The reason I am choosing ChaseCam over CameraNode is because of the smooth movements offered by the ChaseCam.

Adding the delete mapping code for each of the protected mappings solved the problem and works exactly as I wanted it to. Thanks!

also looking at the code you should be able to use the constructor:

[java]ChaseCamera(Camera cam); [/java]

this wont register with the inputmanager and so you shouldn’t need to delete the mappings as it never creates them