How to avoid big agent to overlap obstacles

The ships is trying to reach the harbour, but the street is blocking it but I would like it to stop a bit sooner so it doesn’t overlap the street.

How can I do this? 1 way would be to increase the width of the streets colliders but that would give me other navigation problems.

Any hint please?
Thanks in advance

Hello.
Since no one has unsubscribed, it means it’s not easy. I’ve already done about this. It was necessary to stop the warrior within striking distance.
Here is the algorithm.

  1. First you check the availability of the path to the port.
  2. If the path is not available, find the end point of the path. This is the point where your ship is currently in the picture.
  3. Find the previous point. But it’s not perfect. It may be necessary to find the point following it, but I did not do this.
  4. Look for the direction vector. From the end point of the path to the previous point.
  5. This vector is multiplied by the distance you need. You add the resulting vector to the end point of the path. This is a new point and there is what you need.

Here is my example.
https://forum.arongranberg.com/t/how-to-go-to-the-neighboring-node-is-there-an-easy-way-to-colorize-a-line-renderer/12743

Thanks, If thats the only option I’ll give it a try.
I thought there would be a built-in way to achieve this but this is a good one.

Thanks a lot for your answer!

Hi

To handle things properly for a very long and narrow agent like that you would need pathfinding that takes into account the agent’s rotation. This is not something that is implemented in this package, however. Usually in games you just treat agents as circles and make sure that they can fit regardless of the orientation of them. In this case, You can either make the collider wider (though you didn’t want this), or you could for example use the Grid Graph → erosion iterations settings to shrink the graph. Or the Grid Graph → Collision Testing → Diameter setting which will do essentially the same thing for this use case.

So if I handle this properly the graph will shrink to avoid the agent to rotate on any area without colliding on obstacles, is this correct?
Thanks for your help

Yes, that is correct.