New problem with drag'n'drop

Hello again everybody…  :smiley:



I have the following code on my MouseInputHandler


if(hitItems.contentEquals("hidrogenio") && hitDistance < 30)
                    {
                            bolinhas.getChild("hidrogenio").setLocalTranslation(
                                    camera.getLocation());
                           
                    }// fim do if



to drag an sphere, child of node bolinhas, called "hidrogenio". But when I do this action, I cannot see the sphere, but when I set the bound to be visible, I saw that its moving...

What I have to do to see the sphere, and what I have to do to, when I release the mouse, the sphere stay on the location of when I released the mouse?  :?

Please help....

Thanks.....  :wink:

Guilherme

please help me…

I need to know how to move the sphere according to camera moviment, making the sphere taking the mouse position!!!



Please, help…



Thanks a lot…



Guilherme  :slight_smile:

see http://www.jmonkeyengine.com/jmeforum/index.php?topic=3691.msg29361#msg29361



:smiley:



Seriously, though, re-typing your problem is still double posting…  :roll:



Here's what might be your answer:



right after

bolinhas.getChild("hidrogenio").setLocalTranslation(camera.getLocation());


add

bolinhas.getChild("hidrogenio").updateWorldData();


Note, though, that your code will move your sphere to the camera location, is that what you want it to do?

I reckon you want to drag around your spheres, using the mouse pointer location on screen. There is no trivial solution to this, since you are in 3d, you'll have to project your 2d mouse pointer location to a 3d location in some way.
(A rather intuitive way might be finding the plane that is rectangular to the camera's view direction and goes through your sphere's original location, and project your mouse pointer to that plane to obtain a 3d location).
Of course, you could also define a fixed plane for your spheres, that would be simpler to do.