kpgbrink Posted February 25, 2017 Share Posted February 25, 2017 Is it possible to make a ground from a heightFieldImpostor? I need to do this in order to use get height at coordinates for my game. Or is there a way to use get height at coordinates with a heightFieldImpostor? mwissink 1 Quote Link to comment Share on other sites More sharing options...
kpgbrink Posted February 25, 2017 Author Share Posted February 25, 2017 I mean how to make a GroundMesh from a Mesh. Sorry for being confusing. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 25, 2017 Share Posted February 25, 2017 By creating a field with CreateGround, and then serializing it, you get a mesh and not groundMesh. This is what I do for my terrainEditor. And to get the height of a dots on this mesh, I do this: var getHeightMeshAtCoordinates = function(mesh, x, z) { var maxHeight = 256; var ray = new BABYLON.Ray(new BABYLON.Vector3(x, maxHeight, z), new BABYLON.Vector3(0, -1, 0), 2*maxHeight); var res = mesh.intersects(ray, true); return res.pickedPoint.y; }; mwissink and kpgbrink 2 Quote Link to comment Share on other sites More sharing options...
kpgbrink Posted February 25, 2017 Author Share Posted February 25, 2017 Thanks that works 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.