GetRandomReachablePointInRadius : Return a random valid point within a radius which that specific actor can reach
GetRandomPointInNavigableRadius: Returns a random valid point within a navigable area, but not necessarily one which the actor can actually reach (i.e. it could be on an island)
I tried both GetRandomReachablePointInRadius and GetRandomPointInNavigableRadius.
I’ve noticed these two functions won’t give me a location on navmesh sometimes (maybe because it fails).
So I call ProjectPointToNavigation on the out location given by these two functions which will give me a location on navmesh if it succeeds.
But sometimes the ProjectPointToNavigation fails on the out location given by GetRandomReachablePointInRadius but succeeds on the location given by GetRandomPointInNavigableRadius.
So I am confused about the difference between these two functions? And how I should choose between them.
There is no clear description on what makes a point navigable but not reachable and vice versa.
Let’s assume you have your map and some boxes around on it. You also have a narrow path surrounded by boxes. It’s so narrow that if a character is slightly larger than a standard character, it won’t be able to squeeze and get through. You create the nav mesh and it calculates the obstructions. You place your AI on the map within the limits of the nav mesh, setup the move/patrol task and hit play.
If you used the “navigable” one, you’ll get a random point on the nav mesh, it could be anywhere. That could be on the narrow path which is considered navigable by the nav mesh. But the AI won’t be able to reach there.
Using the “reachable” one will not generate a point on those kind of places.
So I guess GetRandomPointInNavigableRadius = GetRandomPointInNavigableRadius + reachable check.
I’ve done some tests on these two functions and noticed that sometimes these functions return false (which could due to no navmesh in the radius) but even they return true, the navlocations given by them can NOT be projected to the navmesh sometimes (ProjectPointToNavigation returns false).
will return a point on navmesh if succeed, but it doesn’t check whether the point is on a connected navmesh which the Origin (first parameter) is on.