Exclude nodes in NNConstraint

Hi,
While working on my project I found that it would be really useful if NNConstraint would allow us to manually set some nodes that should be ignored in methods such as GetNearest().

For example - for turn-based games, it is recommended to store units positions in some sort of manager and then use this info in TraversalProvider to avoid them when calculating paths without modifying the walkability of a node. This makes perfect sense but there isn’t such a way for example finding closest node for a particular unit. In case like this it would be really useful to pass nodes list to the NNConstraint that would allow us to get nearest node as the node under the unit would be unwalkable.

I don’t know if I making myself clear - I would be more than happy to explain the idea further.

Hi

You can create a subclass of NNConstraint and override the Suitable method to do whatever filtering you want.

1 Like

omg I forgot how extendable A* Pathfinding Project is! Thanks for pointing that out!

1 Like