Path intersection

Hi Aron,

I want to check if a path intersects with other path/s. So is there a built in functionality to do this or I have to implement it myself and if so can you guide me on where to start because the only method I can think of is by getting vectorPath then loop for each line with other path/s vector paths which could be so performance intense. I think the other way is to get the nodes of the path and check if it is occupied by another path or so but this what you will suggest and I need your suggestion please.

Thanks in advance.

Update:
Also I think that if I think bottom up will be; i.e.: how to request a path on a grid graph but with excluding certain nodes. In that case I will guarantee that new paths will return with out intersecting current paths’ nodes.

Hi

Usually you do not really want to make sure that no two characters traverse the same nodes in their paths (take for example two characters with one walking a few meters behind the other one, they will traverse the exact same nodes but that’s no problem because they do not occupy the same nodes as the same time). I have done some experiments with cooperative pathfinding (see http://arongranberg.com/2015/06/cooperative-pathfinding-experiments/) but it’s not ready to be released yet.

I think you should try some local avoidance scheme instead. Maybe the one that is included in this package or something simpler like just raycasting a meter or two in front of the character and slowing down/turning if it detects that it would hit another character (even a simple approach like this often yields good results and is pretty performant).