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);
}
}
posted on 2025-09-12 17:31  偷懒的阿贤  阅读(19)  评论(0)    收藏  举报