Cam.getLocation late?

Hi.



I have since I started using JME always had a small problem with the getLocation and getOrientation methods of Camera.



It seems to me like the values returned are always one frame behind the actual values of the camera.

It's like the values you get are the next to last set values.



Has anyone else experienced this?



Is there some update-call I should make before getting the values or something?

i experienced the same.



in my case it was (as suggested above) the cameraNode. I read the data from the camera and the cameraNode was updated later in the scenegraphs update-order. this means that the cameraNode sets the new Camera coordinates for the next frame but you read the one from the frame before.



I solved it by reorganizing my scenegraph a little so the cameranode is updated at the very beginning and i can read the correct data later in the update cycle.

Are you perhaps using a CameraNode? It takes its own position/rotation and updates the camera. It is possible that the camera is not yet updated at the time you are reading values from it. CameraNode has a method updateCamera() if i remember correctly.

Thanks!



I now call updateWorldData on cameraNode before getting the location and orientation and now I get the correct values.