Defining the AI Navigation Area
Defining the AI Navigation Area
The AI navigation area is the traversable area for the AI characters. AI characters use this area to find their way through the play space.
In this tutorial, create and set up the AI navigation area with the Navigation Area component.
To define the AI navigation area
In the viewport, right-click and choose Create entity.
In the Entity Inspector, enter a name for the entity such as AiNavigation.
Choose Add Component and add the Navigation Area component.
Under the Navigation Area component, click Add Required Component. This adds the Polygon Prism Shape component to the entity.
Select the entity in the viewport.
ExampleYour entity and its components should look like the following.
In the Entity Inspector, for the Navigation Area component, click the + icon for the Agent Types property and then in the drop-down menu, select MediumSizedCharacters.
In the Polygon Prism Shape component, for Height, enter
3.0
meters.In the Lumberyard Editor main menu, choose Game, AI, View Agent Type, MediumSizedCharacters.
MediumSizedCharacters should be toggled on and appear with a check mark in the AI menu.
A blue box appears inside the navigation area volume that you created. The AI characters use this blue region to define the path data, so that they can navigate through the play space. Note
If the blue box doesn’t appear, toggle off Visualize Navigation Accessibility. To do this, choose Game, AI, Visualize Navigation Accessibility.
If the box still doesn’t appear, ensure that Continuous Update is on. To do this, choose, Game, AI, Continuous Update.Select the AiNavigation entity and in the toolbar, click the Align to object icon
, and then click the maze_wall_exterior or maze_wall_interior entity in the center of the maze.
Select the AiNavigation entity again. You should see four red vertices each numbered
0
to4
.Select and drag each vertex to create a perimeter around the exterior maze wall.
ExampleYour volume should look like the following.
If you look at the position of the navigation area, you will notice that the navigation area is not touching the ground. This also means that path information is not defined. Select the AiNavigation entity and lower it to the ground.
ExampleA blue path should appear between the maze walls like the following.
Note
If your navigation area fills the entire space, the AI characters can navigate this space but they will also potentially get stuck against the interior walls. The AI characters will assume that the areas by the wall are a viable path.
ExampleTo fix this, define the navigation area to go around the inner walls. In the Entity Inspector, select and expand the maze_wall_interior entity, press Shift and then select all the child entities in the slice.
In the Entity Inspector, for the Transform component, select the Static property. This property tells the navigation AI to exclude these areas as a viable path.
Press Ctrl+S to save your level.