A* Pathfinding Project

Corner nodes after erosion on Grid Graph


#1

Hello all. I just started using the free version, and I’m marveled about how great it works.

However, I am having some trouble with the node generation on grid graphs. More specifically, around the corners.

The red capsule is what I am moving around. The grid graph makes those extra nodes at the corners of the meshes, and they allow my capsule to get much closer to not passable areas than its intended.

Below are the settings used to make this grid. The capsule has default size.

Tagging areas around the corners would be absurd work, since the grid already nailed the sides without them.
Is there any setting I can use to get rid of these extra nodes at the corners?


#2

Hi

The grid graph erodes the graph along the 4 axis aligned connections. If using the Collision testing -> diameter setting does not work for you, I suppose you could change the grid graph to erode along all 8 connections.

In the GridGraph.ErosionAnyFalseConnections method, change this line

for (int i = 0; i < 4; i++) {

to

for (int i = 0; i < 8; i++) {

You could alternatively subclass the grid graph and override the method there, in order to make it easier to upgrade the package in the future. See this post for how to do that: Tag Grid Nodes by altitude


#3

Thanks for the quick answer!

I attempted using 0.5 and 2 on collision diameter, but no success.
So I changed the code as suggested, subclassing it, and it works with an exception.

The pick next waypoint setting lets the capsule enter the purple mesh depending on where it was and where I set the destination. I experimented setting it from 1 to 0.25, and now only a minor deviation from the path occurs but no mesh-entering.

Works good for now.