TraversalProvider GetTraversalCost with "GraphNode from"

Hi @aron_granberg. As in the topic title, could You add similar method in ITraversalProvider to CanTraverse(Path path, GraphNode from, GraphNode to) but for GetTraversalCost?
It would be useful to know the previous node, so that in some situations I could determine the cost based on it, e.g. when I want to determine the cost based on the slope between nodes (uphill costs more), or if I want to escape from nodes marked as “Attack of Opportunity”, where the cost is calculating when I’m leaving the node and not when I’m entering to it.

Like a GetTraversalCost(Path path, GraphNode from, GraphNode to) method? I might be misunderstanding the method (I’ve never used it myself :D) but wouldn’t foreach’ing the nodes in question get you this information?

Just double checking for my own sake :slight_smile:

Yes, its simmilar to this topic (Accessing previous node in TraversalProvider) and why I cannot foreaching the nodes from the path. Because I assume the cost inflicts pathfinding.

I’m sorry I think I’m misunderstanding this; it inflicts pathfinding?

Yes, in this method you can write some rules about what cost should be used to enter the node. Pathfinding uses this cost to determine whether it will continue searching the path through that node or take another node to find a cheaper path.

I’ll tag @aron_granberg on this then to review if this is something he’d either want to add or is already supported in some way. Thanks for bringing it to us :slight_smile:

Thanks! Imho it would be usefull as hell just as “CanTraverse” with “from” node;)

Hi @aron_granberg, I’m sorry for tagging You (again), but I need to know at least Your opinion about this topic. Is this something I could count on in the near future or maybe I should think of another solution?