Support Forum

IsPathPossible or some other way to determine if destination is reachable?

I’m trying to determine if a destination if accessible or not which is primarily contingent on wether or not other agents are standing in the way. If other agents are blocking the route or are standing around the desired destination, my agent just runs into them endlessly. Instead, I’d love to know if the path is obstructed and have them choose a different course of action.

I’m trying out PathUtilities.IsPathPossible but it is returning true because I believe it’s probably relying on node walkability and not wether the agent can actually move from one point to the other. Is there another method I could check out for this? Or is there some other way I could tell the system to block paths when agents are in the way?

I’m using RVO which is working ok for group movement and general avoidance but I want to check if a destination (aka a Vector3 that I’m using to GetNearestNode) is accessible before I ever set my agent into motion.

Hi

In the beta version, I have 2 prototypes for this. However, the agents will only be able to detect this once they are actually blocked by others. There’s no corresponding IsPathPossible call.

You could check if there are many other agents around the destination, and in that case abort. But other than that, there’s no clear solution. This is assuming your game has free movement. If movement is tied to a grid or similar, then there are other solutions.

1 Like

Interesting! Even having some kind of trigger for when they’re blocked by others would be useful for my situation. I’m using the beta, could you point me towards an example or a doc for this?

Additionally, is there some built-in method for returning agents within a specific area? I noticed one of the beta components has a “stop if destination is crowded” type toggle so I assume there is.

There is

var simulator = RVOSimulator.active.GetSimulator() as SimulatorBurst;
var area = quadtree.quadtree.QueryArea(position, radius);

It will find the total agent area inside the circle at position with the given radius.

So if you do something like:

quadtree.QueryArea(position, radius) / (radius * radius * math.PI)

that will give you the density of agents from 0 to 1 (though 1 is not actually attainable with packed circles).

You can use

rvoController.rvoAgent.CalculatedEffectivelyReachedDestination

which will have one of these values:

However, documentation is sparse right now.

1 Like

Fantastic, and thanks for the quick reply! I’ll check this out tonight.