Path to close to collider

Hi,

I have multiple agents in a scene. All of them have the same unity size visually (1U) and circle collider diameter (0.75U). I configured the grid as followed:


With the given node size and diameter I’m expecting that an agent is considered as being 1.15U in diameter (I added some extra clearing already here, it would even be better if this could be smaller).

Anyways, I get the problem that paths are always extremely close to any obstacles.

As you can see here (green line for pathfinding), the colliders (marked in red - sorry for the free-hand drawing) and the path will for sure lead to a collision. This is a big problem and it seems, no matter what settings I select paths are always too close to obstacles - which will lead to a collision. The “Shrimp” (Obstacle) is also having an untraversable TAG (Applied with GraphUpdateScene). I already tried to use erosion but this does not work for the TAG only for the obstacle layer masks.

The Seeker on the agenda is as followed:
image

This problem gets more extreme once I apply any modifiers (obviously).

What am I doing wrong or misunderstanding here?

Any help is welcome

Hi

Tags do not work with erosion, I’m afraid. So if you want the agent to move further away from the shrimp, you need to expand the graph update scene component.
You can also use the alternative approach for grids mentioned at the bottom of this page: Multiple agent types - A* Pathfinding Project, but I would recommend expanding the graph update object as that’s easier.

Thanks for the reply. I was already playing around with the ITraversalProvider but from my understanding this influences the whole grid, right? As I’m having multiple agents using the same grid and some might be able to traverse while others won’t (details problem and question can be found here: Performance implication for multiple agents and pathfinding setup) I opted against.

So I will extend the GraphUpdateScene.

But anyways, it’s still to close even when erosion does not work on TAGS, the size of the colliders is not correctly considered ?!

Hi

The ITraversalProvider allows you to override walkability/cost on a per path basis. So you can give one ITraversalProvider to one agent, and another ITraversalProvider to another agent, and they may compute different values and will do their pathfinding completely independently. The ITraversalProvider does not intrinsically store any state in the graph.

1 Like

@aron_granberg Is there a way to retrieve information from the surrounding world (e.g. entities/GameObjects)? I remember reading that Unity functions can not be used when MT in the ITraversalProvider is used. But it would be necessary to get some positions of those entities that should be avoided.

Hi

There’s no such functionality built in, I’m afraid.