Lumberyard
User Guide (Version 1.15)

Navigation Area

This feature is in preview release and is subject to change.

The Navigation Area component defines the features of a navigable area or volume for use by the AI System. You use this component with the Polygon Prism Shape component, which defines the volume of the navigation area.

Note

When you add a Navigation Area component, you must also add the Polygon Prism Shape component.

For instructions on how to adjust the Polygon Prism Shape component, see Polygon Prism Shape.

When you create a Navigation Area, all areas that are traversable by the specified AI Agent Type show as blue when you render the navigation mesh. Any areas that are not traversable render as blank areas, such as deep pits and steep slopes. Exclusion areas and areas around static objects also render as blank areas. Even if your navigation area is divided into separate pieces by static objects, terrain features, and exclusion areas, each traversable area renders blue.


            Navigation Area component properties.

You can use a Navigation Seed component to fine-tune AI accessibility.

To add a Navigation Area

  1. In the Viewport, near where you want to create your navigation area, right-click and choose Create entity.

  2. With your new entity selected in the Entity Outliner, add the Navigation Area component to it.

    
                    Navigation Area component properties.
  3. In the Navigation Area component, next to Agent Types, click +.

    Next to [0], select MediumSizedCharacters. This property defines the types of agents that can navigate in this area.

  4. Add the Polygon Prism component. Adjust the size and shape of the Polygon Prism. Ensure that your terrain and objects intersect with the volume of the polygon prism. Adjust the height if necessary.

    If your polygon prism hovers above your terrain and does not fully intersect with it, the navigation system does not produce the appropriate traversable areas. The following examples show a navigation area that is too high above the terrain (1), and a navigation area appropriately situated on the terrain (2). If your navigation area is too high, use the move tool to lower the Z (up and down) position of the entity.

    
                    Enable Show Navigation Areas and View Agent Type in
                        Lumberyard Editor.

To view the generated Navigation Area mesh

  1. In Lumberyard Editor, choose Game, AI, Show Navigation Areas.

  2. In Lumberyard Editor, choose Game, AI, View Agent Type, and then enable the agent type that you want to display.

    
                    Enable Show Navigation Areas and View Agent Type in
                        Lumberyard Editor.
  3. In Lumberyard Editor, choose Game, AI, Generate All AI.

    A navigation mesh is generated showing traversable areas in blue. To enable continuous update, which shows changes in the navigation mesh as you modify the terrain or area, select Game, AI, Continuous Update.

Navigation Area Component Properties

The Navigation Area component has the following properties:

Agent Types

Specifies the types of AI that can traverse this navigation area. These agent types are defined in lumberyard_version\dev\your_project_name\Scripts\AI\Navigation.xml. To specify multiple agent types for this area, click the + icon.

You use this property to restrict which agents can navigate within that area. For example, you can allow characters to navigate within a narrow corridor but restrict vehicles.

To define an agent type on your AI, see the Navigation component.

Exclusion

When selected, creates a subtractive navigation area. This creates a cutout within an existing navigation mesh. For more information, see Creating Navigation Mesh Exclusion Areas.


            Enable Show Navigation Areas and View Agent Type in Lumberyard Editor.

Navigating Around Static Objects

When Lumberyard creates the navigation mesh, it can automatically exclude areas that should not be traversable, such as a large boulder or tree trunk. To ensure that these areas are correctly detected by the navigation system, you must specify its Transform component as static.

To mark an entity as static

  1. In the Entity Outliner, select the entity. This can be a tree, boulder, building, or any object that you don't want the AI to walk through.

  2. In the Transform component, select the Static property.

    The following example shows a navigation mesh around a boulder when the Static property is not selected.


                Navigation mesh goes through the boulder because Static
                    is not selected on the boulder's Transform
                    component

The following example shows the same navigation mesh, but with the Static property selected on the boulder.


                Navigation mesh creates an exclusion area around the boulder, because
                        Static is selected on the boulder's
                        Transform component

Creating Navigation Mesh Exclusion Areas

You can use the Navigation Area component to manually create areas to exclude from the navigation mesh. This means that the AI agents cannot traverse these areas. To do this, you create a navigation area and select the Exclusion property, as shown in the following image.


                Select the Exclusion property to create a navigation
                    area that subtracts from the navigation mesh

The following example shows a navigation mesh (1) and the same navigation mesh with an exclusion area (2).


                Navigation Area component, when marked as an exclusion,
                    subtracts or creates a hole or non-traversable area in the navigation
                    mesh

To create an exclusion area

  1. If you have not already, you must first create a navigation area that is not an exclusion area.

  2. Create an entity, and add to it the Navigation Area and Polygon Prism Shape components.

  3. In the Navigation Area component, select the Exclusion property.

  4. In the Viewport, place the exclusion area within the navigation mesh.

  5. Shape the polygon to the preferred shape for the exclusion area.

EBus Request Bus Interface

Use the following request function with the NavigationAreaRequestBus EBus interface to communicate with other components of your game.

For more information about using the event bus (EBus) interface, see Working with the Event Bus (EBus) System

RefreshArea

You can use the PolygonPrismShapeComponentRequestBus to modify the polygon prism area by adding, removing, and updating its vertex positions. Use RefreshArea to update the navigation area after making changes to the area.

Parameters

None

None

AZ::ConstPolygonPrismPtr

Scriptable

No

Note

The Navigation Area component depends on the Polygon Prism component, which also uses VertexContainer functions. For more information, see Vertex Containers.