Navmesh Pathfinding


maybe i’m just a bit too dumb for it, but the information on how to use the UNavigationSystem is pretty sparse.
I would just like to get the basics on it.

So, my main questions are:
How do i initialize the NavSys from code?
How do i calc the next point to move to for a given destination?

If the Navigation System works like the one from UE3, is there a NavigationHandle i need to get from somewhere, or do the Pawns generally have support for pathfinding already included and it just needs to be enabled?

Thanks in advance,

Just in case you haven’t seen it, there’s some information about using the navigation system on this thread:
UE4 Pathfinding basic AI

Hi Indy,

I’m not sure what you mean. A lot of basic stuff is already being done for you, so Navigation System gets initialized upon creation of UWorld, and “Next Path Point” is picked by PathFollowingComponent.

It’s nothing like the one in UE3 :smiley:

AI in general is capable of pathfinding, provided it has relevant components: [FONT=Courier New]UNavigationComponent and [FONT=Courier New]UPathFollowingComponent, both of which are being created for default AIController. The main functions you need to look at regarding movement are [FONT=Courier New]AAIController::MoveToActor and [FONT=Courier New]AAIController::MoveToLocation. To make a human-player controlled pawn find and follow a path look at [FONT=Courier New]UNavigationSystem::SimpleMoveTo[Actor/Location] functions.

Let me know if you have questions. And share your feedback! :slight_smile:



that was exactly the information i was searching for! :slight_smile:

For some reason i thought that the flow would be similar to how it was in UE3, but this is really nice and easy now.

Much Thanks and Cheers,

Glad you like it! In general Keep It Simple is our main principle when it comes to engineering AI code. Whenever you see something that could be done simpler just let us know!