Pathfinding locked to a grid; nearest neighbor to blocked tile

First off thanks for the excellent pathfinding system. It was extremely easy to get up and running.

I’m working on a 3D game where all of the actor movement is constrained to a grid on a mesh. Point-and-click movement, so you would click a grid tile and your character paths along the grid to the destination. The basic movement works great using a grid graph with the Manhattan heuristic.

One issue I ran into is how best to path the character when the user clicks on a non-walkable grid tile. For example, let’s say there is a large 3x3 trap door on the floor that can be interacted with but not walked over. The player clicks the trap door. He can’t path into the door, so his path should be the shortest between him and any tile adjacent to the door.

I came up with a solution that seems hacky, but it works and is bug-free so far. I attach a second Seeker component with modified behavior to the player. Whenever a non-walkable interactable object is clicked, this modified Seeker creates N paths where N is the number of walkable tiles adjacent to the object. It calculates their total length, picks the shortest, and sends that over to the player’s normal movement Seeker.

This seems like a more robust solution than simply finding which adjacent walkable tile is closest to the player as the crow flies since the actual literal distance between the player and any tile can’t be relied upon to give the shortest path (obstacles may make the distance longer than an object-adjacent tile that is further from the player). But it feels like I’m doing way more work than may be required. Is there a more elegant way to go about this?

I think setting the navigation target to off mesh already gets the agents navigating to the nearest point on the nav mesh.