FindPathToLocationSynchronously()
example:
FHitResult Hit;
if (GetHitResultUnderCursor(ECC_PhysicsBody, false, Hit))
{
CacheDestination = Hit.ImpactPoint;
}
if (UNavigationPath* NavPath = UNavigationSystemV1::FindPathToLocationSynchronously(this, ControlledPawn->GetActorLocation(), CacheDestination))
{
Spline->ClearSplinePoints();
for (const FVector& PointLoc : NavPath->PathPoints)
{
Spline->AddSplinePoint(PointLoc, ESplineCoordinateSpace::World);
DrawDebugSphere(GetWorld(), PointLoc, 8.f, 8 ,FColor::Green, true, 5.f);
}
}