- Home /
The nearest to the end point walkable node with A* Pathfinding!
Hi!
I am using A* astarpath for my turn-base game.
I am using the ITraversalProvider interface in my turn-based game. So far it’s great help. However, when I am trying to search for a path to a walkable node that is blocked via ITraversalProvider , it returns an empty array. Shouldn’t it look for an alternative path instead? (to a closest walkable node on graph)
So the question is, how can I get the path to the nearest available (walkable) node on graph while still using ITraversalProvider blocking system? I love it and would like to keep the functionality.
This is my solution from reading other topic of same problem, but it does’t work.
Thank you.
Example of requesting path:
public class MyNNConstraint : PathNNConstraint {
public override bool Suitable (GraphNode node) {
return base.Suitable(node);
}
}
void getPath
{
Path p = ABPath.Construct(start, end, null);
p.traversalProvider = mytraversalProvider ;
MyNNConstraint MyNNconstraint = new MyNNConstraint();
p.nnConstraint = MyNNconstraint ;
seeker.Startpath(p);
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613015141im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Astar Pathfinding ai moves more nodes than it should 0 Answers
A* Pathfinding in a turn based game 3 Answers
Board-game pathfinding system (Similar to Mario Party style) 1 Answer
Question about tactics movement 0 Answers
Help with my 2d pathfinding 0 Answers