Dad72 Posted February 11, 2014 Share Posted February 11, 2014 hi, How do I get the height (Y-Axis) of a point on the ground by pickinfo. I would like to add to the grass when we click on a points of ground.I am missing just the point Y of the place clicked for that my grass is not below the ground when she is added. Thank you for your help. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 12, 2014 Author Share Posted February 12, 2014 Nobody has an idea? please. Quote Link to comment Share on other sites More sharing options...
Gugis Posted February 12, 2014 Share Posted February 12, 2014 var point = scene.pick(e.clientX, e.clientY); if(point.pickedPoint){ var pointY = point.pickedPoint.y; } Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 13, 2014 Author Share Posted February 13, 2014 Thank you, but I was talking about to retrieve the point Y of the terrain when I click on a places any of the ground.here on a pickedpoint, it retrieves the position x and z of an object. The x and y position of a pickedpoint are in a world 2d and me I wish the Y position of the 3d world. Quote Link to comment Share on other sites More sharing options...
Samuel Girardin Posted February 13, 2014 Share Posted February 13, 2014 Hi, You should have a look to the Worldmonger demo. on babylon website. I think there is what you want. Another solution would be at start up to store in an array each pixels of your heightmap . After with your event x z and few calculations, just look in the array at the right index to get your y elevation (the gray level), etc..and adapt it to your world. Sam. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 13, 2014 Author Share Posted February 13, 2014 Thank you Samuel. I know this Worldmonger demo. I use it in my project where I've added functionality for my game editor. But I do voi not where recover the height of a point following the click. I'll look again. May be that Deltakosh would have a idea? Quote Link to comment Share on other sites More sharing options...
Samuel Girardin Posted February 13, 2014 Share Posted February 13, 2014 In fact, I've just test var pickResult = this.scene.pick(evt.clientX, evt.clientY); this.iniScene.moveBox(pickResult.pickedPoint); pickResult.pickedPoint is vec3 (x,y,z) , and I can move a box at the right heigh on my ground terrain. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 13, 2014 Author Share Posted February 13, 2014 Thank you very much Samuel, I am going to test this. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 13, 2014 Author Share Posted February 13, 2014 Yes, this has run. I did not know that pickedpoint retrieve a Vector3. in the documentation, it says that it is a Vector2. But thank you for your help. Quote Link to comment Share on other sites More sharing options...
Temechon Posted February 13, 2014 Share Posted February 13, 2014 I will fix that tomorrow. Sorry for this mistake. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 13, 2014 Author Share Posted February 13, 2014 No probleme Temechon. Thanks for the fix. 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.