a few things i noticed:
that is unnecessary, because with:
Vector3f loc = sphere.getLocalTranslation();
loc.z -= 1;
you are directly modifying the spheres's location. (loc is a reference not a copy)
In simple scenes the localtranslation of an object is often equal to the world translation.
In your case, i would just use the spheres localtranslation, to set the cameras position.
Try to print out local and world translations, the world translation is not always up-to-date, depening on when exactly in the update cycle you access it.
well, printing out the translations did actually show the problem, the global translation doesn't change.
So even though i change the local translation, the sphere does not actually move, but the camera is still set to the right position as if the sphere would move.
Just figured i might have missed an update function for the position or something similar, guess that was right.
updateWorldVectors() did the trick.
thank you for your help.
once every update cycle updateGeometricState() should be called on the rootNode (and thus on the whole scene as it is recursive)
This does call updateWorldVectors() internally.
This is already done for you if you use SimpleGame for example.