I have coded my self into a corner again…
This looks to me like a JME bug, but as usual, more likely to be something crazy I have done…
Will the getScreenCoordinates call to DisplaySystem return the correct screen coordinate of any point in the scene, even when moving the camera around with a cameraNode??
To mee it looks like the screen coordinates starts out right, (in x,y = 0) but when I move the cameraNode in any direction, the screen coordinate is following the cameraNode (and the parent object).
When moving the camera I have called updateWorldVectors() on the cameraNode before calling .update() on the camera itself.
Any hints on what to update, or what I could have missed??
Aha!
I found the gurbus myself…
My cameraNode was attached to another node… So, allways remember to call updateWorldVectors(); for all nodes in the camera chain, and camera.update(); after that. Then all points in the scene are mapped correctly to the screen coordinate system.
updateWorldVectors is called for a Node and all it's childeren when you call updateGeometricState.
Ok… My mistake was to call update() on camera every time i did a localtranslation of the cameraNode. if I did that, I manually had to call updateWorldVectors on parent objects before calling update() on camera.
Thanks for the comments!