Units moving from point A to B in a longer way

Hi, I have a little conundrum.

My units seem to be moving from point A to B in a longer way than necessary?

It’s like they are using the sides of the triangle instead of the hypotenuse, which would be the shortest rout.

https://youtu.be/VXmDgTnpvxM

Thanks in advance for the answer!

Hi

Since you are using a grid graph, the world is discretised into small tiles, in this graph there are actually many possible equally shortest paths and those that it finds are one of the possible shortest paths (for some more info about this, see: https://arongranberg.com/astar/docs/pathfinding.html#Heuristic).
However it is possible to post-process the path to shorten it further. This is possible by adding the RaycastModifier component to your agents. If you have the pro version I recommend that you enable the ‘Graph Raycasting’ option and disable ‘Raycasting’, if not, you can use the normal raycasting option but then you have to configure the layer masks for your colliders.
See https://arongranberg.com/astar/docs/raycastmodifier.html

1 Like

Hi. :slight_smile: Thank you very much.

I will now delve deeper into these links and try to figure out what to do next.

Thanks again!