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:

Multiple navigation meshes

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

Multiple navigation meshes

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 the scene (RAIN | Create NavMesh). Rename the first navigation mesh to Navigation Mesh Small and the new one to Navigation Mesh Large. In the large one, set the Walkable Radius parameter to 1.75. Generate this mesh and see how it goes over the second bridge but not the first:

Multiple navigation meshes

It is a navigation mesh with a larger walkable radius that can cross one bridge.

Then, to match the meshes with the characters for Navigation Mesh Small, make sure that you are in Advanced Settings and in Graph Tags, add an element called Small Ship.

The following is a screenshot of a navigation mesh with a graph tag:

Multiple navigation meshes

Do the same for Navigation Mesh Large with the Graph Tags field set to Large Ship. Then, for the smaller ship character AI, go to the Navigator tab and set its Graph Tags field to Small Ship:

Multiple navigation meshes

This is a ship navigator with a graph tag setup.

Do the same with Graph Tags for larger ships. With the graph tags matched, if you run the demo now, the larger ship will not take the smaller bridge and go through the smaller one:

Multiple navigation meshes

This is a demo with two ships. Only the larger ship can cross the larger bridge.

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

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