Culling areas

Being able to set up areas as walkable or not is an important part of creating a level. To demo this, let's divide the level into two parts and create a bridge between the two. Take our demo and duplicate the floor and pull it down. Then transform one of the walls to a bridge. Then, add two other pieces of geometry to mark areas that are dangerous to walk on, like lava.

Here is an example setup:

Culling areas

This is a basic scene with a bridge to cross.

If you recreate the navigation mesh now, all the geometry will be covered and the bridge won't be recognized. To fix this, you can create a new tag called Lava and tag the geometry under the bridge with it. Then, in the navigation meshes' RAIN component, add Lava to the unwalkable tags. If you then regenerate the mesh, only the bridge is walkable. This is a screenshot of a navigation mesh with polygons that are under the bridge culled out:

Culling areas

To see this in action, create a new ship and add a target to the scene on different sizes of the bridge. Set the ship's behavior tree to have a move node with the target, as shown in the following screenshot:

Culling areas

The preceding screenshot shows a basic move node to a navigation point behavior tree.

If you run the demo now, you will see the ship cross the bridge:

Culling areas

The preceding screenshot shows the ship crossing the bridge to go to its navigation target. Using layers and the walkable tag, you can customize navigation meshes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.107.55