[SOLVED]problem with getWorldCoordinates

HI ,

I have a problem …



I use a MouseListener to retrieve the coordonates of my mouse on my screen ,these coordonate are good

And translated into world coordonate,

The world coordonate seems good

But if I try to place an element as a box

With setlocaletranslate

The box is not moved over the whole of my screen, but simply a small middle part


   Vector3f mouseWorldCoords= display.getWorldCoordinates(mymouselistener.getScreenCoords(),0);
         
      
         box.setLocalTranslation(mouseWorldCoords.getX(),+mouseWorldCoords.getY(),1);





in my console

com.jme.math.Vector2f [X=194.0, Y=613.0]    //screen coordonate
com.jme.math.Vector3f [X=-0.41406247, Y=0.29817706, Z=14.000002] //seems good world coordonate

How can I get my box move on all screen  ?

thx.

The position of the object on the screen in relation to the world coodinates depend on the position of the camerat and the distance of the object away from the camera.

Try hardcoding some object positions and see where they pop on the screen, then analyze the values you are setting via mouse listener using those objects as a point of reference. Then you will be able to pinpoint your problem.



Node: you need to call updateGeometricState() or updateWorldVectors() after setting the local translation.


Ok then
The multiplier is equal to
Z position of the camera -
Z position of the object to be moved
In my situation

depends on where is ur box attached? is it attached to the root node? if it is directly attched to the root node, then u r doing the right thing. if not the local coordinates for the box is not the same as the world coordinates u retrieved.