The function NavSystem->GetRandomReachablePointInRadius doesn't always work as expected. It works fine for me, if I use very small radii around the origin. If I use a larger radius, I get unreachable locations.
My levels and the NavMesh are built procedurally at runtime. At the moment there are often isolated areas. It's like the destinations I am getting are chosen for a different origin than the one I passed to the function. A typical scenario from my current testing would be this:
Is there a reason why this sort of thing would happen??
I double and triple checked all involved locations, origins and destinations, and there is no problem to be seen there. Unless GetRandomReachablePointInRadius requires something other than abolute world-locations, I have no idea what's going on here, so I'm assuming it's a bug.
asked Jan 01 '17 at 11:51 PM in Bug Reports
If I'm not mistaken, this behaviour is caused by the ARecastNavMesh::GetRandomReachablePointInRadius function using the same radius for both, dtNavMeshQuery::findRandomPointAroundCircle and dtNavMeshQuery::findNearestPoly.
dtNavMeshQuery::findNearestPoly mustn't be called with a large radius, as this function may (and will) return invalid results if the search range covers more than 128 polygons (see DetourNavMeshQuery.cpp).
Luckily ARecastNavMesh::GetRandomReachablePointInRadius is virtual, so it's possible to work around this issue in project code, namely by using a custom NavMesh class inheriting from ARecastNavMesh, which then overrides GetRandomReachablePointInRadius and limits the value put into
answered Nov 23 '17 at 04:42 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here