Is it possible to Lock Specific Agents to Moving only in Orthagonal Directions in a Grid Graph?

I have two units on a grid Graph.

I want one to be able to move in only orthagonal directions (North, East, West & South).
I want another to be able to move in orthagonal AND diagonal directions. This is the default on most things.

The easiest way I’ve found to do this is to have two graphs. One where each node only has 4 connections and another where each node has 8. I was wondering if it might be possible to do this on one Grid Graph in some fashion.

If not that’s fair. I appreciate any help, I’m more looking into the limitations of the system and ways to make things work right. I would feel that having multiple graphs might be less efficient or cause unexpected behaviours.


It is technically possible to do this using an ITraversalProvider (see Agent-Specific Pathfinding - A* Pathfinding Project). However, that will require some custom code.
Having two graphs is definitely simpler, but will double your memory usage. If your graphs is small enough, this is usually not a problem, though. I’d recommend trying the simple solution first, and you can switch to the more complex solution in the future if you need it.