Hello,
I am trying to check for a path that I know will be blocked by wall, and therefore impassible. I am using something like this:
GraphNode node1 = AstarPath.active.GetNearest(point1, NNConstraint.Default).node;
GraphNode node2 = AstarPath.active.GetNearest(point2, NNConstraint.Default).node;
if (PathUtilities.IsPathPossible(node1, node2)) {
// Yay, there is a path between those two nodes
}
I tried adding traverseable tags to the nnconstraint, with no luck. I set point 1 to the seeker’s current transform position, and point 2 to the destination object’s position. I also tried NNConstraint.None, but it still keeps returning true.
Hi
Is this wall blocked because it has a tag that is not traversable? The IsPathPossible method only checks for if there is a path of walkable nodes between the start and end, it does not check for tags at all.
There is another overload of the IsPathPossible method that takes a tag mask as well, however that is significantly slower as it cannot use precalculated data.
This wall has a tag that marks the area it covers as non-traversable, for that particular seeker type. I thought setting the constraint’s tags would solve this, but it didn’t seem to work.
NNConstraint nnConstraint = NNConstraint.Default;
nnConstraint.tags = Seeker.traversableTags;
I did see this version of the function:
IsPathPossible (nodes, tagMask)
Returns if there are walkable paths between all nodes.
But that is a check for all nodes, whereas I only need it between 2 points, so that I know which path failed.
Hi
You can just make a list of size two then. That will be equivalent.
1 Like
Ohhhh, my bad, I thought it did a check to see whether travel is possible between any two node combinations on the entire grid. (facepalm)
It works, thank you!
1 Like