You can tag arbitrary areas of your NavData with custom data called NavTags, which you can use to influence the way your characters plan and follow paths in the area at runtime. For example:
For example, the following image shows a terrain set up with several different types of NavTags:
NavTags may be represented by either:
There are multiple possible approaches to embedding NavTags into the static NavData that you pre-generate for your terrains.
Each time your GeneratorInputProducer class provides a triangle to the NavData generation system, it can tag that triangle with a particular type of NavTag.
Your GeneratorInputProducer class can specify volumes that define which NavTags should be applied automatically to all triangles that intersect the volumes. To use this approach:
You can add NavTags dynamically at runtime either by spawning TagVolumes and assigning them to your Databases, or by using the dynamic BoxObstacle and CylinderObstacle classes provided by the dynamic obstacle management system. The NavMesh in the area of the new TagVolume or the obstacle is automatically re-generated and re-triangulated to reflect your custom NavTag.
For details, see Using Dynamic Obstacles and TagVolumes.
You can choose a color for rendering the triangles and TagVolume based on their NavTag. The colors help in identifying NavTags quickly.
You can set the DynamicNavTag color using these functions:
If you set a NavTag as exclusive, its color is automatically set to red as shown in the following figure.
Additionally, the default color for a runtime TagVolume is dark orange as shown in the following figure.
Following parameters for NavTag color are added in the GeneratorAdvancedParamaters class:
These colors are automatically set for the NavTag during the generation time. The m_emptyDefaultNavTagColor parameter or m_nonEmptyDefaultNavTagColor parameter is set for the default NavTag depending on whether it is empty. This applies to all the triangles by default.
The m_nonDefaultNavTagColor parameter is set for the NavTag in the following cases:
The m_nonDefaultNavTagColor parameter is not set if you change the color of the NavTag before adding the triangle or TagVolume.
You can modify these colors in the Advanced Parameters panel of the Navigation Lab. See the following figure:
The following methods are added in the DynamicNavTag class:
If you use NavGraphs in your terrain, you can tag their vertices and edges with NavTags too.
See also Creating NavGraphs.
When two or more areas tagged with different NavTags overlap, the NavTags are not merged. Instead, the NavTag that is determined to be lower by calling the < operator of the NavTag class is kept.
For example, in the following image, the exclusive volume is lower than the orange volume, which is lower than the green volume, which is lower than the light blue volume.
See the implementation in the navtag.h file for details.