Get Nearest Node in Given Direction

Is there a built-in way to get the nearest node in a given direction? As it stands, the nearest node may result in a less than optimal path if trying to reach the closest edge of an irregular shape.

For instance, in this example, the red circle is where the AI went and the green circle is where I wanted him to go.

Technically the red circle is the nearest node, which is why I need it to factor in direction as well. Maybe I’m going about this the wrong way, as I really just need the AI to reach the closest edge of the unwalkable area. Can you recommend a simple way to do this?

Any help is appreciated, thanks!

Anyone have an idea? Are these forums even active, it’s hard to tell with the huge amounts of spam.

Out of my head; there’s a function which returns points around a specified point (pathutilities). You could compare distance or even path-lengths to them and chose the one with the smallest.