Problem with making a terrain

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By honzah70

I am trying to make “2D” terrain. I discovered that in the Editor you can make a CollisionShape with a HeightMap Shape. With OpenSimplexNoise I managed to edit the HeightMap so that it has some random elevation.

godot terrain collision

However it only applies to the CollisionShape and I don’t know how I can “link” it with a Mesh so that the Mesh is the same shape as the HeightMap.

I found out that you can make a CollisionShape based on a Mesh. Is there a way to make it the other way around?

:bust_in_silhouette: Reply From: Zylann

Godot does not come with a terrain node to render heightmaps, so you have to script that.

There are several ways to go:

Final note: be aware that in a heightmap, one cell == one vertex. So if for example you need a 1x1 terrain, you actually need 2x2 cells, because a quad contains 4 vertices. So if you need a 100x100 terrain, you will need 101x101 cells, and so on. See HeightMapShape is too small by one cell in each direction · Issue #58933 · godotengine/godot · GitHub

Thanks, this is what I was looking for!

honzah70 | 2022-03-18 23:40