@Override
    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);
        this.inputManager = app.getInputManager();
        target = new Node("ChaseCamTarget");
        camNode.setCamera(app.getCamera());
        camNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera);
        target.attachChild(camNode);
        camNode.setLocalTranslation(0, 0, distance);
        upVector = app.getCamera().getUp().clone();
        leftVector = app.getCamera().getLeft().clone();
        registerWithInput();
        rotateCamera();
    }
This class is a camera controller that allow the camera to follow a target
Spatial.

@author Nehon
jme3-core/src/main/java/com/jme3/app/ChaseCameraAppState.java