I have a Grid Graph (Ray collider type) for a 2D game and movement is constrained to be inside a node/tile, not a free movement.
If I set Connections to Four, all paths are calculated perfectly around the tiles, but then I get mostly Zigzag paths, which is rather bad to see the entities navigating. In the image, the green is how most of the paths are returning and the yellow/red is the kind of path that I’d like to accomplish:
If I set Connections to Eight, I get mostly diagonal paths, which are fine and solve the Zigzag issue, but then entities move inside walls before reaching a close walkable tile. You can see the path line is too close to the obstacle, and then the entity sprite is drawn inside/above the obstacle before going to the free tile:
How to get the desired path of more straights/diagonals while not running inside obstacles?