AI Move To

@Godlike0207
The plugin does exactly that. Box traces in space then finds the most efficient path.

If you want to reinvent the wheel be my guest. This plugin already does what you are asking for.

You other only option if you want pure code would be to implement an A* algorithm to scan your corridors with the size of the cells set to width of the corridor.

https://www.redblobgames.com/pathfinding/a-star/implementation.html