Using Heightmap for 3D terrain
In this recipe, we'll make a basic 3D scene with ground and cubes of various heights. We'll use the GPUParticlesCollisonHeightField3D node to add a 3D heightmap to the scene. We'll create snow using particles and see how the GPUParticlesCollisonHeightField3D node interacts with the particles on the ground and on top of the cubes in the scene.
Getting ready
For this recipe, open Godot 4 and start a new project called Chapter 4
. In the Scene tab, click 3D to add a 3D scene. Click on the word Scene in the top-left corner next to Project, then select Save Scene As and name it Heightmap
.
How to do it…
In this recipe, we will create a 3D scene with cubes of various heights and snow using particles. When we add the GPUParticlesCollisonHeightField3D node, the snow will land on all of the surfaces no matter how tall:
- Right-click on Node3D in the Scene tab and rename it
World
. - Left-click the three vertical dots to...