How do I stop having my ai take short routes and go into places they shouldn't

Hi

This particular case can be fixed by disabling the ‘cut corners’ option in the grid graph settings.