got confused with the cam.getScreenCoordinates().
What is the returned vector3f means?
I thought x,y should be the coordinates of the screen position.
BUT it seems doesn’t go that way.
For me ,x I can understand it goes from 0 to 1366 (my screen resulution: 1366 ,768) but y value just go higher than 768 .
BTW: What I want to do is to track a box and put a text label on the guiNode where the box appear on the screen.
SORRY my mistake
got sth wrong with the code
now the coords are correct if the box is within the screen( It can be seen)
but when the box is outside the screen (cam moved or rotated), the coordinates are strange for me.
Find a way to solve this issue:
First use Geometry.checkCulling() to check if the box is inside a cam
if yes, then use cam.getscreencoordinates
Once you know the world position of the box you can convert to screen space and use the x, y for the guiNode position? When the cam moves or box moves recalculate the position again?
this is the best solution