How do I get the navigation path to a point?

Hi,

is it possible to get an array of all points on the way to the destination point as calculated with the help of the navmesh? I’d like to write my own movement, but still use the default navmesh pathfinding.

Thanks!

Any ideas?

Try looking into “Find Path to Location Synchronously”. It returns navigation path reference that can be used to get an array of vectors. However, this function was missing in 4.3 version in blueprints and I can only confirm its existence in 4.5 (not sure about earlier versions).

Hi, anteevy!

As rambolt said, I guess “FindPathToLocationSynchronously” can be utilized well here.

However, I’m still a newbee, but currently I use something like this:

UNavigationPath *tpath;
UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld());
    
tpath = NavSys->FindPathToLocationSynchronously(GetWorld(), GetActorLocation(), end_point);
    	
if (tpath != NULL)
{
    	for (int pointiter = 0; pointiter < tpath->PathPoints.Num(); pointiter++)
    	{
    		DrawDebugSphere(GetWorld(), tpath->PathPoints[pointiter], 10.0f, 12, FColor(255, 0, 0));
    	}
}

Hope it helps you.