Alby Posted May 9, 2015 Share Posted May 9, 2015 Hi guys! Again me with my lot of requests. I "just" need to move a selected mesh and all the meshes attached to it (but with those meshes remaining attached to the other objects they are bound with, hope to be clear in my explanations) in x,y,z : (http://playground.babylonjs.com/#12ZRI0#5) I think a soluce to do it could be Picking the object I want, so I can have the position (X0,Y0,Z0) of it (and the bounding point of all the other meshes attached to it) Translate this in canvas coordinates (http://www.html5gamedevs.com/topic/9584-converting-3d-vertex-to-2d-point-on-screen/?hl=coordinate#entry77509) move the object in mode canvas in X,Y plane with my mouse (http://www.babylonjs-playground.com/#12ZRI0#5) and in Z (using the 'Z' key + mouse) Calculate and translate all those X,Y "canvas" moving (Xoffset and Yoffset - in mode just mouse) and Z moving (Zoffset - in mode 'Z'+mouse) back in 3D coordinates The initial coordinates become then X0=X0+Xoffset, Y0=Y0+Yoffset, Z0=Z0+Zoffset and all the others coordinates remain unchanged Redraw all the scene Is my reasoning good? First I tried to adapt in (http://playground.babylonjs.com/#12ZRI0#5) to suit my needs, inspiring from the demo (http://playground.babylonjs.com/?18) But already there I encounter some problems and didn't understand very well the need of a ground to operate it: When I click by example on "a bedouin", all the tubes attached to it move but "disconnect" from others objects they are attached (sphere, box) When I click on "Mona Lisa" the tube connected with "a bedouin" doesn't move and but the other tube disconnects too from the other object to which it is attached (sphere) In those cases the text move with the box picture But When I click on the text under a picture box even it is a child of the box it belongs to, it has a strange behaviour when moving and the parent box doesn't move anymore with it. So wondering what's happening? Can somebody give me some light? Thank you in advance! Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.