How to increase Diagonal cost

Can I increase the diagonal cost between nodes having higher penalty?

If two diagonal nodes have higher penalty then I need to increase the diagonal cost too.
Please help how to do this.


Currently there is no way to do this because grid connection costs are hard coded to reduce memory usage.

You can of course do it by modifying the code slightly.
Take a look at the Open method in the GridNode class. There is one line that looks like

uint tmpCost = neighbourCosts[i];

See for which indices map to diagonal nodes.

If you change it, you will want to make it symmetric so that moving from node A to B always has the same cost as moving from B to A, otherwise the pathfinder may get confused.