Lumberyard
User Guide (Version 1.15)

Regenerating the Navigation Mesh

This topic references tools and features that are legacy. If you want to use legacy tools in Lumberyard Editor, disable the CryEntity Removal gem using the Project Configurator or the command line. To learn more about legacy features, see the Amazon Lumberyard Legacy Reference.

There are situations where the navigation mesh must be dynamically updated in real time in order for an AI agent to make sense of its environment. For example, when an object is destroyed the AI agent can now navigate through the space.

Dynamically generating a navigation mesh could also place an AI agent outside of the mesh, leading to stuck or inconsistent behavior.

You can regenerate the entire mesh or a portion of it.

Complete Mesh Regeneration

If you want to regenerate the entire navigation mesh, do the following:

To completely regenerate the navigation mesh

  • In Lumberyard Editor, select the mesh and then click AI, Request a Full MNM rebuild.

Partial Mesh Regeneration

There are two methods for regenerating a portion of a navigation mesh. Both methods only regenerate the relevant portion of the mesh. By not regenerating the entire mesh, performance is kept high.

The following method is a non-runtime generation of the mesh.

To partially regenerate the navigation mesh

  • In Lumberyard Editor, click AI and enable Continuous Update.

You can also do a runtime partial regeneration of the mesh using the following Flow Graph nodes. Flow Graph is accessed from Lumberyard Editor by clicking Tools, Flow Graph.

Entity:GetBounds – Obtains the bounding box size, in local or world-space coordinates, for any entity in the mesh. This gives information about the location inside the mesh that requires updating, such as where an object moved to and how big it is.

AI:RegenerateMNM – Specifies the minimum and maximum world-space coordinates of where the navigation mesh regenerates at runtime in response to geometry changes, such as a bridge collapsing or a path becoming blocked, for example.