To create navigation meshes, Navigation Areas need to be added to your level in the Editor. Below, you'll find a simple overview of this process.
The following menu items can be found inside the "AI" menu from the main menu.
Menu Item | Description |
---|---|
Create New Navigation Area | Create a new Navigation Area, similarly to shape objects. |
Request a full MNM rebuild | Recalculate entire navigation data. |
Show Navigation Areas | Show or hide the Navigation Areas. |
Add Navigation Seed | Add Navigation Seed object. |
Continuous Update | Enable or disable automatic mesh updates while editing the map. |
Visualize Navigation Accessibility | Display navigation reachable areas in blue and unreachable areas in red. |
Debug Agent Type | Agent type for which debug information is displayed. |
Visualizing the navigation mesh in the Launcher is possible. The following CVars are required:
To create a new Navigation Area:
The generation of the navigation mesh goes in a separate thread, so it doesn't stall the Editor.
To see the generated mesh, set the console variable ai_DebugDrawNavigation to 1, 2, or 3. Make sure you also set ai_DebugDraw 1. Or simply use the DebugAgentType option in the AI menu.
A common mistake when creating navigation areas is to create them on or above the terrain surface, or object surface. This can cause the mesh to fail.
Make sure you place the base of the shape underneath the terrain/object and the roof of the shape above the terrain/object, allowing for plenty of clearance.
Bad Mesh - Debug Navigation Off | Bad Mesh - Debug Navigation On |
---|---|
Good Mesh - Debug Navigation Off | Good Mesh - Debug Navigation Off |
If you don't want navigation mesh to be generated in some areas within a navigation area:
Exclusion Areas will be colored red to indicate they cannot be used by AI to navigate within. The same will also happen to Navigation Areas which simply cannot be reached by AI (blocked by terrain/objects, etc)
There could be cases in which areas marked as non-reachable are still important for the level design. In this case, you can place a Navigation Seed on this areas to inform the navigation system that you want to consider that spot like if an agent was placed there.
Note that the "Navigation Seed" position will be used for all the navigation meshes the seed is enclosed into, while a specific agent will calculate the accessibility only for his specific navigation type.
The following picture shows a part of a level where the Navigation Area object is much bigger than the section where the medium sized characters are placed and where they can actually find a path:
If the upper part of the valley is important for your gameplay design, just place a navigation seed on it and it will be marked with the blue color:
Seed points are used to highlight isolated areas of the navigation mesh:
If Continuous Update is on, modifying the map (e.g. adding / deleting / moving objects or modifying the terrain) that affects navigation causes the navigation system to automatically recalculate the navigation mesh to reflect these changes.
Only those parts of the navigation area which are affected by the change will be recalculated.
You can quickly tell if the Nav Mesh is being updated by a small character icon being displayed in the top left of the screen.
If you don't wish for the navigation data to be processed on-the-fly like this, you can simply disable "Continuous Update" in the AI menu:
You may sometimes receive a "Navigation System Warning" when trying to save/export your level while the navigation is being updated. This warning is to prevent the navigation that is being processed from becoming corrupted and you should avoid interrupting it to be safe.