A* Pathfinding Project

Problem with cars going wrong way


I am making game, with traffic, something similar to old GTA( 2D Top down).
Problem is cars are always taking shortest path, which results going wrong way when they turn left on crossroad.
Somehow they need to know, shortest path is not good.
I think of something like giving to car object a Tag indicating current rotation, then when it will be close to crossroad it will recalculate Path using its own Tag and node tag.
So Somehow Path generated must omit all nodes with incorrect Tag.
Is that possible? Any tips?
Pathfinding.ITraversalProvider i’m trying to use this.



Pathfinding which includes direction information is unfortunately not possible out of the box with this package. This requires several changes to the core pathfinding algorithms to work I’m afraid.