Trying to return whether a Vector2 is on a valid walkable area

Hi, I am trying to make my AI randomly wander when idle. I am simply using a physics circle cast to pick a random vector2 point around the enemy, and then make the seeker move to that point. However, if the point on the other side of a wall or in a unwalkable area, the seeker just walks into the wall tryng to get there.

Is there anyway to run a check first on the point to see if its curently in a walkeable area before passing it to the AI?


You can use

var info =, NNConstraint.Node);
if (info.node == null || !info.node.Walkable) {
    // No closest node was found, or that node was not walkable
} else {
    //  The closest node was walkable and the closest point on that node was info.clampedPosition

If the Seeker starts to walk into the wall you might want to change the Seeker -> Start End Modifier -> End Point field. You probably want to set it to ClosestOnNode.

Thanks for the great reply :slight_smile:
I will try the code now, as for the walking into walls issue, Closest On Node is already set for both start and end. It may well be that the code sorts out the issue anyway as the path should never be in an unwalkable area. I’ll let you know. thanks!