Using CameraController and CameraPerspectives

Good evening everyone,



I'm having trouble using the CameraController and getting CameraPerspectives to do what I intend…

I instantiate and a CameraController like this


      GameControl toggleCameraControl = getGameControlManager().addControl("toggleCamera");
      toggleCameraControl.addBinding(new KeyboardBinding(Keyboard.KEY_F8));
      cameraController = new CameraController(getMainGameState().getRootNode(), getGame().getCamera(),
            toggleCameraControl);



After that I create some CameraPerspectives on the fly and add them to the controller.
Now the first problem is: F8 does not toggle the camera perspective, whereas if I implement the functionality myself using a GameControlAction, it does the job perfectly fine.

Second, I do not get when exactly the update-method in the CameraPerspectives is being called.

Say, I want to implement a perspective where the camera is positioned above the center of a bunch of given objects. So I calculate the avarage position of the objects, and pass the new x and z values to the new location vector, maintaining the camera's hight (the y value).
I put this in the update-method of the CameraPerspective, but it seems to be never called.

What am I missing? Unfortunately this part of the API is not very well documented.

Thanks.

Okay, I figured it out after a while: I forgot to attach the CameraController to a GameState's rootNode.