Custom TraversalProvider that doesn't mark nodes as being "permanently" non-traversable

I’d like to implement differenciated climb & drop distances (climb distance being shorter than the drop distance) in a Grid Graph

I’m using a grid graph, and right now I’ve achieved this by modifying the pathfinding algorithm directly in the plugin, but that’s kinda dirty.

I initially implemented that in a custom TraversalProvider (which checked the node’s height compared to the current node), and although it mostly worked, some edge cases were failing. This is due to the fact that once you return false from CanTraverse for a specific node, it’s marked as non-traversable for the entirety of the remaining pathfinding calculation.

In my case it shouldn’t be permanent, it’s non traversable from the current node, but it might be traversable if we’re coming from another node.

Is there a way to work around this?


In the beta version you can implement the

public bool CanTraverse (GraphNode from, GraphNode to) {

function in the ITraversalProvider interface. This allows you to access both the current node and the candidate node.

Yes this is the way I did it, but if during a pathfinding job you return “false” from that method for a specific candidate node, it won’t ever be considered for traversal, which is a problem!

Oh wait, I meant I tried that in this method:

public bool CanTraverse(Path path, GraphNode node)

Are you telling me that this new one you’re showing won’t have this behaviour?

Yes indeed. That is what I mean :slight_smile: