Using Navigation Invokers

This guide shows how to use Navigation Invokers.

Windows
MacOS
Linux

Overview

Unreal Engine's Navigation System allows Agents to navigate the Level using a Navigation Mesh for pathfinding. In addition to the various Runtime Generation methods for the Navigation Mesh, the system also includes a way to only build the navigation locally around specific targets.

Navigation Invokers are Blueprint Actor components that generate the Navigation Mesh around the Agent at runtime. Using Navigation Invokers removes the need to build the Navigation Mesh in the editor and can also limit the number of tiles generated at runtime.

Navigation Invokers are ideal for big Levels where building the Navigation Mesh in the editor is impractical.

Goals

In this guide you will learn to use Navigation Invokers with your Agents to generate the Navigation Mesh during gameplay.

Objectives

  • Create a new Level and configure the Navigation System to use Navigation Invokers.

  • Modify the ThirdPersonCharacter Blueprint to roam around the Level using Navigation Invokers.

1 - Required Setup

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

    Create-Project.png

  2. Select the Third Person template and click Next.

    Create-Project2.png

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

    Basic-Create-Settings.png

Section Results

You created a new Third Person project and are now ready to learn about Navigation Invokers.

2 - Creating Your Test Level

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

    New-Level.png

  2. Select the Default Level.

    Select-Level-Template.png

  3. Select the Floor Static Mesh Actor in the World Outliner and go to the Details panel. Set the Scale to X = 100, Y = 100, Z = 1.

    Create-Floor1.png

    Invokers-Floor-Scale.png

  4. Click Settings > Project Settings and go to the Navigation System category. Enable the Generate Navigation Only Around Navigation Invokers checkbox.

    Project-Settings.png

    Invokers-Settings1.png

  5. Go to the Navigation Mesh category and scroll down to the Runtime section. Click the Runtime Generation dropdown and select Dynamic.

    Invokers-Settings2.png

  6. 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. Scale the Nav Mesh Bounds Volume to X = 500, Y=500, Z = 10.

    Invokers-NavMesh-Drag.png

    Invokers-NavMesh-Scale.png

Section Results

In this section you created a new Level and configured the Navigation System to use Navigation Invokers.

3 - Creating your Agent

  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 into the NavigationSystem folder and select the option Copy Here.

    Move-Blueprint.png

  3. Navigate to the NavigationSystem folder and rename the Blueprint to BP_NPC_Invoker. 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.

    Custom-Event.png

  5. Right-click the Event Graph, then search for and select Get Actor Location.

    Get-Actor-Location.png

  6. Drag from the GetActorLocation node and search for and select Get Random Reachable Point In Radius. Set the Radius to 1000.

    Get-Random.png

  7. Drag from the Random Location pin of the GetRandomReachablePointInRadius node and select Promote to variable.

    Promote-Variable.png

  8. Connect the MoveNPC node to the RandomLocation node you just created.

    MoveNPC.png

  9. Right-click the Event Graph, then search for and select AI Move To. Connect the RandomLocation node to the AI Move To node.

    AI-MoveTo.png

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

    Reference-Self.png

  11. Connect the Self node to the Pawn pin of the AI Move To node. Connect the yellow pin of the Random Location node to the Destination pin of the AI Move To node, as seen below.

    Blueprints1.png

  12. Drag from the On Success pin of the AI Move To node, then search for and select Delay. Set the Duration of the nodeto 4. Drag from the Completed pin of the Delay node, then search for and select MoveNPC, as seen below.

    Blueprints2.png

  13. Repeat the steps above to add these nodes to the On Fail pin of the AI Move To node. Set the Duration of the Delay node to 0.1.

    Blueprints3.png

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

    Begin-Play.png

    Move-NPC.png

  15. Go to the Components tab, click the Add Component dropdown, then search for and select Navigation Invoker.

    Invokers-NPC-NavInvoker.png

  16. With the Navigation Invoker component selected, go to the Details panel and find the Navigation section. Here you can change the Tile Generation Radius (radius around the actor used to generate Navigation Mesh tiles) and Tile Removal Radius (radius from the actor used to to remove Navigation Mesh tiles). For this example, set these values to 3000 and 5000, respectively.

    Invokers-NPC-NavInvoker2.png

  17. Compile and save the Blueprint.

  18. Drag several BP_NPC_Invoker Blueprints to your Level and click Simulate to see the navigation generating around each Agent.

    Invokers-NPC-Drag.png

    If you don't see the navigation, press P on your keyboard to visualize the Navigation Mesh.

    Invokers-Agents-Walking.gif

Section Results

In this section you created an Agent that roams around the Level and uses the Navigation Invoker component to build the Navigation Mesh around itself.

언리얼 엔진 문서의 미래를 함께 만들어주세요! 더 나은 서비스를 제공할 수 있도록 문서 사용에 대한 피드백을 주세요.
설문조사에 참여해 주세요
건너뛰기