Zig Zaggy paths

Hi,

Im using the excellent A* library to generate some paths.

However they paths are very zig zaggy even when there aren’t any obstructions.

For example:

                                     _________________________start
                                  __|
                                 |
                                finish

How can I use the library to generate ‘straighter’ paths?

Many thanks!

Hi

Try using either the funnel modifier or the raycast modifier or the simple smooth modifier.
See http://arongranberg.com/astar/docs/modifiers.php

These dont seem to make much difference for me.

The character still doesnt take a direct route.

i.e. instead of drawing a straight line between start and finish the character follows the path described above.

Is this related to the grid size/resolution?

Hi

Due to the way pathfinding works, it is only possible to find paths going through node centers, that is why you get a zig zaggy path. Usually you post process the path to smooth it out.
The Raycast Modifier or the Funnel Modifier is probably your best bet, make sure that the Seeker doesn’t warn you about incorrect modifier ordering (will be visible in the Seeker inspector if that is the case).
You should attach the modifiers to the same object as the Seeker component is attached to.

If you have the pro version you can try out the recast graph (along with a funnel modifier) which will give you much better paths.

On a grid graph, you can try to increase the Heuristic Scale to something like 1.1 in A* Inspector -> Settings -> Pathfinding.