How to test if a position is in Navmesh?

I searched on forum and it says that UNavigationSystem::ProjectPointToNavigation() is the function to check if a position is in NavMesh, but when put a Cube that Scale is 20.f at location(2000.f, 2000.f) on my Level, and use test code:

UNavigationSystem* const NavSys = GetWorld()->GetNavigationSystem();
FNavLocation Loc1;
FNavLocation Loc2;
FNavLocation Loc3;
FNavLocation Loc4;
FNavLocation Loc5;
FNavLocation Loc6;

bool rs1 = NavSys->ProjectPointToNavigation(FVector(2000.f, 2000.f, 0.f), Loc1);
bool rs2 = NavSys->ProjectPointToNavigation(FVector(1500.f, 1500.f, 0.f), Loc2);
bool rs3 = NavSys->ProjectPointToNavigation(FVector(1000.f, 1000.f, 0.f), Loc3);
bool rs4 = NavSys->ProjectPointToNavigation(FVector(900.f, 900.f, 0.f), Loc4);
bool rs5 = NavSys->ProjectPointToNavigation(FVector(800.f, 800.f, 0.f), Loc5);
bool rs6 = NavSys->ProjectPointToNavigation(FVector(500.f, 500.f, 0.f), Loc6);

all return value are true, Is there any wrong to use ProjectPointToNavigation? or how to use ProjectPointToNavigation?

Have anyone comes across this problem?

ProjectPointToNavigation doesn’t check if the position is on navmesh. It returns the closest position that is on the navmesh instead.
See this:
It returns FVector, not bool.

Yep, you’re right. I have sorted it out with UNavigationSystem::TestPathSync :

UNavigationSystem* const NavSys = GetWorld()->GetNavigationSystem();
APlayerController* PC = GetWorld()->GetFirstPlayerController();
if (!NavSys || !PC)

const ANavigationData* NavData = NavSys->GetNavDataForProps(PC->GetNavAgentPropertiesRef());
if (!NavData)

FVector TestLoc(1000.f, 1000.f, 0.f);
FPathFindingQuery Query(PC, *NavData, PC->GetNavAgentLocation(), TestLoc);
if (!NavSys->TestPathSync(Query))