How to test if a hit result is within navigation mesh?

Hey guys, I’m stumped on this one. I’m attempting to create a waypoint for a teammate ai character to run towards by running a line trace when the player clicks on a location in world space. The problem is I can’t seem to find anything to test if that hit result location lies within the navigation bounds.

I’ve looked at ‘Project Point to Navigation’ and it still gives me the closest result on the navmesh, even if outside the nav bounds. What I need is to immediately tell the player ‘no, that point cannot be reached’. This is a BP only project.

Help me @MieszkoZ, you’re my only hope. :wink:


I ended up ‘solving’ this by using a line trace hit location as the input for the ‘Project Point to Navigation’ node and then comparing that result with the original hit location. If the two vectors were equal or the ‘Project Point to Navigation’ result came back as 0,0,0; then the project failed to find a location. So far, so good.

I know that it’s late to reply to this. However, another solution that also works is by getting the Navmesh actor Reference and then getting the actor bounds. Then, check if the actor is within that Box’s bounds.

A function like this can then become useful for many other types of within-area calculations.

Maybe as a prepass. But just because you click on something inside the bounds doesn’t mean its a navigable location.

You understand he wants to create a waypoint they can run to. Meaning Inside the bounds, and part of the actual nav mesh. if he clicks on top of a wall inside the nav mesh what happens? Its not navigable. He gets something close. Within bounds is the wrong thing to test for.