Penalty for changing direction

Hello, I’m wondering now if there’s any way to apply a penalty for changing direction? For example I’m making a top-down 2d game with a grid graph and if the unit has to move diagonally I believe it will move 1 up 1 right 1 up 1 right for example (because I’m using 4 directional connections in the grid). I’d rather have it move 2 up then 2 right. I think this would be calculated in the pathfinding algorithm. Just wondering if it’s possible. Thank you.

Hi

There’s no way to add a penalty for changing the direction (this would require quite large changes to the whole pathfinding algorithm). However you can try to adjust the A* Inspector → Settings → Heuristic setting. Try to set it to Manhattan, that might work better.