Custom Navigation Areas and Query Filters Preparation Guide

This guide covers the preliminary steps needed to learn about Custom Navigation Areas and Query Filters.

Choose your operating system:

Windows

macOS

Linux

Overview

This document will guide you through the preliminary steps of creating a Level and AI Agent to learn about the Custom Areas and Query Filters in the Navigation System.

You can also download the full sample project , which includes all the material covered in this guide.

Objectives

  • Create a new Level and set up navigation by placing a Navigation Mesh Actor in the Level.

  • Modify the ThirdPersonCharacter Blueprint to navigate toward its target by using specific Query Filters.

1 - Required Setup

  1. In the New Project Categories section of the Unreal Project Browser, select Games and click Next .

    Select the Games category and click Next

  2. Select the Third Person template and click Next .

    Select the Third Person template and click Next

  3. Select the Blueprint and No Starter Content options and click Create Project .

    Select Blueprint and No Starter Content and click Create Project

Section Results

You have created a new Third Person project and are now ready to learn about creating Area Classes and Navigation Query Filters.

2 - Creating Your Test Level

  1. Click File > New Level on the Menu Bar.

    Click New Level

  2. Select the Default Level.

    Select the Default Level

  3. Select the Floor Static Mesh Actor in the World Outliner and on the Details panel, set the Scale to X = 10, Y = 10, Z = 1.

    Select the Floor Static Mesh Actor in the World Outliner

    Set the Scale to X = 10, Y = 10, Z = 1

  4. Go to the Place Actors panel and search for Nav Mesh Bounds Volume . Drag it into the Level and place it on the floor mesh.

    Drag a Nav Mesh Bounds Volume Actor to the Level

  5. With the Nav Mesh Bounds Volume selected, go to the Details panel and set the Scale to X = 5, Y = 10, Z = 1.

    Set the Scale to X = 5, Y = 10, Z = 1

  6. Go to the Place Actors panel and go to the Basic category. Drag a Sphere Actor into the Level.

    Drag a Sphere Actor into the Level

Section Results

In this section you created a new Level and added a Navigation Mesh and a Sphere Actor. You are now ready to create an Agent that will walk toward the sphere goal.

3 - Creating Your Agent

In this section you will create an Agent that navigates to its target Actor.

  1. In the Content Browser , right-click and select New Folder to create a new folder. Name the folder NavigationSystem .

  2. In the Content Browser , go to ThirdPersonBP > Blueprints and select the ThirdPersonCharacter Blueprint. Drag it to the NavigationSystem folder and select the option Copy Here .

    Drag the Third Person Character Blueprint to the Navigation System folder and select Copy Here

  3. Navigate to the NavigationSystem folder and rename the Blueprint to BP_NPC_CustomZone . Double-click the Blueprint to open it and go to the Event Graph . Select all input nodes and delete them.

  4. Right-click the Event Graph, then search for and select Add Custom Event . Name the event MoveNPC .

    Right-click the Event Graph, then search for and select Add Custom Event. Name the event Move NPC

  5. Go to the My Blueprint panel and click the Add (+) button next to Variables to create a new variable. Name the variable Target .

    Click the Add next to Variables to create a new variable and name it Target

  6. Go to the Details panel and click the Variable Type dropdown. Search for Actor and select the Object Reference . Enable the Instance Editable checkbox.

    Click the Variable Type dropdown and  select the Actor Object Reference

    Enable the Instance Editable checkbox

  7. Drag the Target variable to the Event Graph and select the option Get Target . Drag from the Target node, then search for and select the Is Valid macro, as shown below.

    Drag from the Target node, then search for and select the Is Valid macro

  8. Right-click the Event Graph , then search for and select Get reference to self .

    Right-click the Event Graph, then search for and select Get reference to self

  9. Drag from the Self node, then search for and select Get AIController .

    Drag from the Self node, then search for and select Get AI Controller

  10. Drag from the AI Controller node, then search for and select Move to Actor .

    Drag from the AI Controller node, then search for and select Move to Actor

  11. Connect the Is Valid pin of the Is Valid node to the Move to Actor node. Set the Acceptance Radius of the Move to Actor node to 50. Drag the Target variable and connect it to the Goal pin of the Move to Actor node.

    Connect the Is Valid pin of the Is Valid node to the Move to Actor node

  12. Right-click the Filter Class pin of the Move to Actor node and select Promote to Variable . Go to the Details panel and enable the Instance Editable checkbox.

    Right-click the Filter Class pin of the Move to Actor node and select Promote to Variable

    Enable the Instance Editable checkbox

  13. Right-click the Event Graph , then search for and select Event Begin Play . Drag from the Event Begin Play node and search for and select MoveNPC .

    Right-click the Event Graph, then search for and select Event Begin Play

    Drag from the Event Begin Play node and search for and select MoveNPC

  14. Compile and save the Blueprint. The final Blueprint should look like the image below.

    This is the final Blueprint Setup

  15. Drag the BP_NPC_CustomZone Blueprint into your Level. Navigate to the Details panel and click the dropdown next to Target . Search for and select Sphere , as seen below.

    Drag the BP_NPC_CustomZone Blueprint into your Level

    Navigate to the Details panel and click the dropdown next to Target. Search for and select Sphere

  16. Press Simulate and watch as your Agent moves toward the Sphere.

    Your Agent is now moving towards the Sphere

Section Results

In this section you created an Agent that navigates toward its goal and can use a Navigation Query Filter. You are now ready to learn about adding Custom Navigation Areas and Query Filters .

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss