Navigation costs - Get units to walk along roads like humans

Hi

You can do something similar in this package.

Either you can use a texture like in that video, or you can use a more automatic approach:

  1. Set grid graph => erosion iterations to something like 5.
  2. Enable ‘erosion uses tags’ and set the start tag to Tag 1.

This will mark the nodes right next to the wall with Tag 1, the ones 1 unit away from the wall with Tag 2, the ones 2 units away from the wall with Tag 3, and so on (up to 5 units away).

Then you can modify your Seeker -> Tags settings to add a penalty for moving close to walls.

(you may have to use higher or lower penalty values depending on the scale of your scene. 1000 is roughly the cost of moving 1 world unit).

Without penalties

With penalties