Book Image

Unity AI Programming Essentials

By : Curtis Bennett
Book Image

Unity AI Programming Essentials

By: Curtis Bennett

Overview of this book

Table of Contents (19 chapters)

Multiple navigation meshes


So far, we have only looked at setting up a single navigation mesh in a scene, but navigation meshes are designed to be per character and not just one for the entire scene. We need multiple navigation meshes, but there is no field to directly set which navigation mesh to use for a character. Instead, RAIN uses a field called graph tags to correlate meshes with characters. To see how this works, let's add a second bridge to our scene that is larger and a second ship with double the scale. Here is an example setup:

This is a demo scene setup with an additional larger ship and larger bridge. Regenerating the mesh gives us a path over both bridges:

This is a navigation mesh with a smaller walkable radius that can cross both bridges.

Any character using this mesh will be able to go across either bridge. For our larger character to not be able to cross the smaller bridge, we need to generate another mesh with a smaller Walkable Radius. Create a second navigation mesh in...