babbleon Posted May 30, 2018 Share Posted May 30, 2018 Hello, Here's the Playground 'Drag & Drop': https://www.babylonjs-playground.com/#17EGSU#10 If you drag, say, the green cube backwards to the edge of the ground... then try and click and drag to get it back, you have to click on the part of the cube above where the extents of the ground is. How do we get around this, so that regardless of the point above the ground and so long as you're clicking on one of the meshes, it drags correctly? Cheers, Quote Link to comment Share on other sites More sharing options...
JohnK Posted May 30, 2018 Share Posted May 30, 2018 The ground is needed as a reference point for the move. See line 91 in the PG which calls the function getGroundPosition lines 71 to 80. You can always make the ground larger and invisible https://www.babylonjs-playground.com/#17EGSU#11 Quote Link to comment Share on other sites More sharing options...
Arte Posted May 30, 2018 Share Posted May 30, 2018 In my project I created fake ground. When your clicked on mesh (get Y position off clicked point), move fake ground to position (Y). Pick point read from fake ground. Not best work around, but works for me. Quote Link to comment Share on other sites More sharing options...
babbleon Posted May 30, 2018 Author Share Posted May 30, 2018 Thank you @JohnK - the ground is always going to have a horizon though. Where in Bucks are you? I spent my student years in Wycombe, what little I can remember of it! & thank you @Arte too - I will have a go with your suggestion. Arte 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.