Adding terrain holes
A limitation of terrains is that they are a single mesh, with points raised or lowered. Sometimes, we want more complex, concave geometry for effects such as caves, tunnels, or just simple holes in the terrain. In this recipe, we’ll build on the previous one to add a terrain hole that leads to another piece of terrain.
Getting ready
This recipe builds on the previous one, so make a copy of that and work from it.
How to do it...
To paint and make use of a hole in a terrain, follow these steps:
- Open your copy of the Unity project from the previous recipe.
- Add a spotlight that shines on where the cube is sitting by choosing menu: GameObject. In the Inspector panel, set its Position to
(0, 0.5, 0)
, Range to50
, Spot Angle to125
, and Intensity to2
. This will allow this light to light up a bonus level that we’ll create beneath our terrain. - Delete the cube from the scene – in a full game, this cube might be...