Hello!
I’m making a RTS, where the battlefield is divided on hexes. So units can move simultaniously, but there can not be two of them on one hex (node).
So I’ve implemented the BlockManager and NodeBlocker, as in the TurnBased Example, and use its Traversal Provider. Everything works good, when Unit2 is on the way of Unit1, the path is being built around it, as it should. But if the end point is on the same node as Unit2, (which is unwalkable for Unit1), than I get an error message “Error: The node closest to the end point could not be traversed”.
But I want to get the path to the nearest available (walkable) node! As it should be, according to the documentation:
“By default, a search for the closest walkable nodes to the start and end nodes will be carried out…”
Example of requesting path:
Path p = ABPath.Construct(start, end, null);
p.traversalProvider = new TacticBlockManager.TraversalProvider(TacticBlockManager.Instance, TacticBlockManager.BlockMode.OnlySelector,
TacticBlockManager.Instance.Obstacles.Where(x => x != myBlocker).ToList());
p.nnConstraint = NNConstraint.Default;
return StartPath(p, null);
Please, help me to request the path correctly.