UDN
Search public documentation

NavigationMeshTechnicalGuide
Licensees can log in.

Red links require licensee log in.

Interested in the Unreal engine?
Check out the licensing page.

Questions about UDN itself?
Contact the UDN Staff

Navigation Mesh Technical Guide

Document Summary: A quick guide to hooking up your AI to use a Navigation Mesh. For an introduction to the Navigation Mesh system in the Unreal Engine, see NavigationMeshReference.

Document Changelog: Created by Matt Tonks.

Overview

This is a quick and dirty guide to hooking up your AI to use a navigation mesh. For an introduction to the Navigation Mesh system in the Unreal Engine, see the navigation mesh reference.

To make your AI pathfind it needs two things; A navigation handle, and it needs to implement the navigation handle interface.

Navigation Handle

(NavigationHandle.uc)

The key distinction between the legacy style pathfinding functions in Unreal and the navigation mesh versions are that the mesh versions all live in the happy land of the Navigation Handle. A navigation handle is simply a component you can snap onto any Actor to give it path finding functionality. The handle keeps track of the current path, as well as talks to the low level data structures for the mesh.

Navigation handle functionality

Path constraint/goal evaluator functions similar to the default unreal versions.

NOTE: You need to add at least one constraint and at least one goal evaluator for a path search to work. Otherwise it won't have any way of weighting your search. This will change soon to have a sane-default configuration (e.g. if you pass no constraints it will push a straight line distance constraint, and a AtGoal goal evaluator).

  • FindPath is just like findpath in Pawn, except it will use the navigation mesh instead of the path node network.
  • PointReachable is similar to pointreachable in Pawn, except it uses the obstacle mesh instead of a bunch of raycasts to determine reachability. This should be much faster than a normal pointreachable check.

Other functions in the Navigation Handle allow line checks directly against the obstacle mesh, as well as offer functionality to find the pylon an AI is currently in, etc.

GetNextMoveLocation

This is a new function, which will attempt to determine the optimal location along an edge for your AI to move to. For example, if there is an edge between polys that's 100 feet long that your AI is moving through, it could run through the center of the edge. However, it's probably better for it to find the closest point along that edge to it to run through and thus shorten its overall path.

Navigation Interface

(Interface_NavigationHandle.uc) The Navigation Handle interface is what allows any actor to pathfind on the navigation mesh. During pathfinding certain basic attributes of the pathfinding entity are needed (width, supported edges, etc.) and this interface is what is queried by the path search functions in order to determine the pathfinding entity's capabilities.

Currently the interface looks like this:

   virtual UBOOL   AbleToSearch()=0;
   virtual FVector   GetSearchExtent()=0;
   virtual FVector   GetSearchStart()=0;
   virtual UBOOL   CanMantle()      { return FALSE; }
   virtual UBOOL   CanCoverSlip()   { return FALSE; }