Myjestic Posted December 8, 2017 Share Posted December 8, 2017 I think this is a simple question (but unfortunately not for me). How can I get the distance between the FreeCamera and a mesh, without using pick? Quote Link to comment Share on other sites More sharing options...
Arte Posted December 8, 2017 Share Posted December 8, 2017 Hi @Myjestic Try BABYLON.Vector3.Distance(camera.position,mesh.position) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 8, 2017 Share Posted December 8, 2017 You can get the distance by doing mesh.position.subtract(camera.position).length() Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 8, 2017 Share Posted December 8, 2017 Oooh, what an answering race... neck and neck. Arte in the gate first, but his solution has more length than DK's. BABYLON.Vector3.Distance(camera.position,mesh.position) mesh.position.subtract(camera.position).length() Should we put them on the griddle, and see which one sizzles more? A little CPU race to decide it all? hmm. Gentlemen... start your rendering engines! Arte 1 Quote Link to comment Share on other sites More sharing options...
Myjestic Posted December 8, 2017 Author Share Posted December 8, 2017 Hey @Arte and @Deltakosh, Both suggestions work fine. Thanks a lot. @Wingnut Let the cooking show start Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 8, 2017 Share Posted December 8, 2017 ALRIGHT! That's the spirit! Ok, now HOW do I do that? Put 1000 of each in for-loops, turn on the browser performance profiling, and wave the green flag? Maybe. I'm scared. Arte 1 Quote Link to comment Share on other sites More sharing options...
Myjestic Posted December 8, 2017 Author Share Posted December 8, 2017 First attempt was this: https://playground.babylonjs.com/#YB6IR8 I think it's not the best way to check performance Quote Link to comment Share on other sites More sharing options...
Arte Posted December 8, 2017 Share Posted December 8, 2017 Mj what you trying to achieve? Sorry i'm not getting Quote Link to comment Share on other sites More sharing options...
Myjestic Posted December 8, 2017 Author Share Posted December 8, 2017 @Arte Sorry, everything is fine and my problem is solved. We just kidding around a bit which variant is more performant. 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.