Do PathUtilities.IsPathPossible(node1, node2) use number of Connections?

Hi,
I have a Grid Graph of 8x13 nodes, and setup for 8 connections and cut corner = true.

At runtime, depends on a pattern, I need to block most of the nodes, only leave some node “walkable”.

please check the below image:
image

  • black: where my agent stands (node X)
  • blue: walkable nodes

node A, B, C are nodes that I want to check pathing to.
the result is:

  • PathUtilities.IsPathPossible(X, A) => true
  • PathUtilities.IsPathPossible(X, B) => true
  • PathUtilities.IsPathPossible(X, C) => false

my assumption is this method still use “4 connections” (red lines in the below image)
image

if I calculate the path from X to B, I receive a diagonal path (orange line in above image)

is there any settings that I can use to make PathUtilities.IsPathPossible(node1, node2) use 8 connections? (so PathUtilities.IsPathPossible(X, C) will return true)

Hi

IsPathPossible (without a tag mask) uses precalculated information and should use the exact same settings as your grid graph. Check with A* Inspector → Settings → Graph Coloring Mode = Tags. If the two nodes have the same color. If so, then IsPathPossible should return true for that pair.

you mean “Areas” for Graph Coloring Mode, right?

this is my graph:

this is how the areas appear:


as you can see, some of the diagonal nodes (similar to node C mentioned) do not have the same color as nodes adjacent to my agent.
I also turn on “Show connections”, it seems they’re not connected to any other nodes.

should I make all the nodes walkable and use node blocker/traversal provider instead?

Ah, right.

Yeah, those diagonal connections will always be filtered away.
However, you can use an ITraversalProvider if you use the beta version and set the ITraversalProvider.filterDiagonalConnections property to false.

See ITraversalProvider - A* Pathfinding Project

1 Like