Disable diagonal movements in FollowerEntity.cs

  • A* version: 5.3.8

  • Unity version: 6000.1.13f1
    I’m using Grid Graph and FollowerEntity.cs since I scale the delta time to a large number. I want to disable the diagonal movements like these and instead only want the agents to follow a up,down,left,right movement. Is this possible? In the grid graph, I already set the connections to 4, and in the followerEntity, I unchecked local avoidance.

You’ll likely want to craft the path yourself and feed them this path through SetPath.

I can’t do that because this environment is created dynamically. What could be the next best solution?

You can still do this if you don’t know what the world is before runtime. You will just have to create the path manually, apply your post-processing (to turn them into non-diagonal paths), and then feed that path to the agent. This would all be procedural and wouldn’t require prior knowledge of the environment.

The follower entity is not built for that kind of movement. It relies on simplifying its path. I would recommend the aipath or ailerp movement scripts instead.

Ok, thank you!