How to get pass/ avoid bottlenecks?

Hi,
I’m developing a TD game where there are situations when the small agents get stuck in corners or between big agents. They can find the path, but can’t get through the narrow bottleneck because of their collision radius. It seems like it doesn’t mean an agent can complete a path even if the path is possible because pathfinding doesn’t takes into consideration the collsion radius of the agents.

I’m having a real hard time with this. Any help will be appreciated. I’m using Astar FREE.

Well, local avoidance would be your best bet~ But that is on A* pro :confused:

You could also try some soft collisions, and alternate paths (See the A* documentation on alternate path) to majorly soften the movement. But errors will probably still happen time to time

A simple way to do some soft collisions would be to create an additional capsule collider, set it to IS TRIGGER and write a script like so~

Sudo code
`
Collision Collision;
bool IsInCollision;

void Oncollisionenter (Collision ThisCollision){
Collision = ThisCollision;
IsInCollision = true;
}
void Oncollisionexit (){
IsInCollision = false;
}

void Update(){

if(IsInCollision == true){
// distance to the colliding object
float distance = Vector3.distance(This.transform.position, ThisCollision.gameobject.transform.position);
// this will return the Rotation Away from the Collision
Vector3 Away = (this.transform.position - ThisCollision.gameobject.transform.position).normalized;

// Now you need to get This Updates movement, the value should be represented by (units new position - its current one)… Lets call this variable “Move”

Move = (Move + (Away * PushSpeed)).normalized * UnitsMoveSpeed 

// this makes sure the unit never go’s faster then its max speed
// NOTE: You should figure out your PushSpeed by using distance * something
}
}
//
`

I don’t have the RVO controller, can’t really test that. I’m trying to work with a solution like what you suggested, but with a raycast detection to avoid it from a distance.

But these solutions doesn’t really crack this problem. If the agents gets stuck in a narrow lane, they would constantly bump into this bottleneck and try to get along the path they are seeing at their front. They can see the path, but can’t pursue.

Is there any way to make the agent avoid this path altogether?

What kind of graph are you using?? It sounds like you need to also give your graph more padding so that the paths wont get so close to the wall~

Also note: soft collisions will probably fix the issues with agents getting stuck on each other, you could also raycast at all other agents to do almost the same thing… but the idea is to have the pathing work like rts game (Like startcraft 2) and allow agents to slightly clip in to each other to allow them to move around each other.

If this it not quite your issue: please feel free to post a screen shot