That looked promising but it doesn’t seem to “project” a point on to the NavMesh in the (x,y) plane. It seems to project a point in the sky onto the ground (z axis) just fine, but I need to be able to project a point completely out of bounds (but on the same plane) back into bounds. Here’s how I was using it:
FVector newGoalVector = UNavigationSystem::ProjectPointToNavigation(goalActor, goalActor->GetActorLocation());
Internally, it looks like this particular call was assigning an INVALID_NAVEXTENT value to Extent. No joy. Then I tried:
UNavigationComponent* PFindComp = nullptr;
UPathFollowingComponent* PFollowComp = nullptr;
AActor* goal = citizen ? container->TargetGoal : nullptr; // set goal. Never null
CitizenController->InitNavigationControl(PFindComp, PFollowComp);
FVector Point = goal->GetActorLocation();
FNavLocation ProjectedPoint(Point);
UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GEngine->GetWorldFromContextObject(goal));
NavSys->ProjectPointToNavigation(Point, ProjectedPoint, PFindComp->GetQueryExtent() , PFindComp->GetNavData(), PFindComp->GetStoredQueryFilter());
Same thing… Still doesn’t project the way I need it to. I can’t find a lot of documentation on Extent (or these functions or how to use them). Any further advice?