Convert Mesh to ground for used updateCoordinateHeights()


I want to convert a mesh to terrain. Which is partly done, but not completely because updateCoordinateHeights() and getHeightAtCoordinates(0, 0) don’t work.

I used bakeCurrentTransformIntoVertices() to transform a plane into a terrain, but I think something is still missing.

Could you help me with this? Thank you.

Heya, those functions are part of the GroundMesh class. You can create a GroundMesh by using CreateGround instead of CreatePlane for example.

1 Like

Yes I am aware of that. But imagining that I create a terrain with 3ds max. once exported, it’s a terrain mesh and not a GroundMesh.

I would like to create my terrain with the modeling software to sculpt it and use it as a GroundMesh afterwards.

Hmm I’ve never tried converting an object of type Mesh to an object of type GroundMesh and the only way I can think of is pretty hacky, e.g. assigning the missing functions from the GroundMesh prototype to the mesh and adding the missing properties as well. Maybe someone else will have a cleaner way but in theory it should work I think, although for an imported mesh I guess would need to iterate over the vertex positions to get the mins and maxes and size which here are already known…


It seems to work that way. Thanks for this solution.

If anyone has another less hacky solution. thank you for letting it know. It would be nice if this was possible in the engine because a GroundMesh terrain is flat and using modeling software to create the terrain allows more, but it’s a Mesh not a GroundMesh.

Thank you Blake for your solution which I hope will be temporary.

1 Like