Carharttguy Posted August 3, 2017 Share Posted August 3, 2017 Hello I use the scene.pick function which is very nice. But I notice is it off on larger distances, is this because of JS number accuracy or is something wrong with the pick function? I've made a small gif to show the problem. First close up, good, then a bit further, and you can see the chest is below the mouse pointer, like 20 px or so. Thanks for insights Mathias Quote Link to comment Share on other sites More sharing options...
Temechon Posted August 4, 2017 Share Posted August 4, 2017 Hi, Are you sure to set the 'camera' parameter in the pick function ? https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.scene.ts#L3578 Quote Link to comment Share on other sites More sharing options...
Carharttguy Posted August 4, 2017 Author Share Posted August 4, 2017 Hi Temechon, thanks for your reply. No I didn't use the camera parameter. My old code was: let pickresult = gEditor.getScene().pick(mouseX, mouseY); New code: let pickresult = gEditor.getScene().pick(mouseX, mouseY, null, true, gEditor.getCamera()); But the result is exactly the same, the code for setting the mesh position is simply: gEditor.getAttachedMesh().position = pickresult.pickedPoint; It's not a huge problem for me, I just find it odd. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 4, 2017 Share Posted August 4, 2017 You have only one mesh? (Only the ground I mean?) Quote Link to comment Share on other sites More sharing options...
Carharttguy Posted August 8, 2017 Author Share Posted August 8, 2017 Hi Deltakosh, Yes, only the groundmesh and the chest mesh. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 8, 2017 Share Posted August 8, 2017 Ok..can you repro in the Playground? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 8, 2017 Share Posted August 8, 2017 using scene.onPointerDown method does not seem to do it.http://www.babylonjs-playground.com/#1D3XZJ#1 which is using the scene.pick function inherently I believe. 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.