A* Pathfinding Project

Compass directional locked point graph


#1

Hello just a quick question with regards to point graph i was wondering if there is a way to lock the point graph to only use 4 or 8 compass directions?

An example would be like this image for 4 compass directions so it would not form diagonal connections only right angle connections:

I presumed that was the idea of the axis aligned settings and the 2D optimization but i don’t want diagonal connections and can’t find a way to stop it.

This is my current settings:

Is it possible to have compass locked point search of any distance? If not could you add it in the next update as its greatly needed for my path connectors.


#2

Hi

Sorry, this is not supported out of the box.
You can however override (or modify) the PointGraph.IsValidConnection method to exclude connections as you see fit (just make sure that it is symmetric so that IsValidConnection(a,b) == IsValidConnection(b,a) ).


#3

I’d like to try out this functionality as well - could you provide a quick demonstration snippet to point us in the right direction (no pun intended)?


#4

Hi Smoke,

Not sure if your message was to me, but I have not tried to implement it at the moment so i have no pointers to provide.