CameraNode isnt working

I have spent several hours searching wiki/forum in trying to find out why something as simple as the camera node, in my instance, doesnt appear to be working. I have attached a box to the CameraNode and I can see this move around the scene. The problem is the camera is not following it.

There must be something obvious that I am missing. Please help, many thanks.

Here is my code…

cn=new CameraNode("CN",new CameraControl(getSimpleApplication().getCamera(),CameraControl.ControlDirection.SpatialToCamera));
cn.setControlDir(CameraControl.ControlDirection.SpatialToCamera); // added a second time as a test

my updater code simply has the following lines…


I looked at the source code for CameraNode and it appears to add a Control which I presume become active once the CameraNode is attached to an active scene graph? There doesnt seem to be anything else that all the examples I have examined include in addition to what I have already have.


If my updater writes to the camera directly the camera moves fine but the whole point of this test is to attach the camera to scene objects so the user can enjoy a 1st person eperience.

Only thing I can think is to verify that it is the same camera that you passed to the node.

Yes it is. When I wrote to the camera directly I referenced it via the CameraNode.getCamera();

It seems to be something with the setEnabled()

As I have many CameraNodes in a scene, all set with the same Camera, I initially set Enabled to false on all of them.

When the user selects to go to one of them it is enabled and then disabled when the user leaves. I initially considered this was how to stop the controllers from interfering with eachother.

I just tried the scene with one cameranode without touching the setEnabled and the camera node worked fine.

Is there a prefered method that I should be using?

I have found out what the problem was. For some reason the activation event for when a camera node was selected was not being triggered. Completely my stupid error. Thanks anyway for assisting me along the path…