How can I detect AI collision with edge of Nav Mesh Volume?

Hello, I’m following the Behavior Tree tutorial from the UE documentation page here: https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/

I finally have everything working fine, except in my level I don’t want the AI to move into certain areas, so I do not have the Nav Mesh Volume go into these areas.

The Behavior Tree as it is setup in the tutorial does not have a condition for reaching the edge of the Nav Mesh. If I lead my AI past the edge of the Nav Mesh Volume, the BT shuts down and the AI becomes unresponsive.

I’m wondering how I would set it up so that the AI will return home if it reaches the edge of the Nav Mesh and cannot get to the Target Location? I imagine I would need to check if the AI hits the edge of the volume, or create a new trigger volume for collision, but I don’t know where to put the check. Thank you!

Without reading the tutorial again, or looking too closely at your blueprints, I would suggest looking at the “Does path exist” node. You can check if the desired location your trying to move towards in navigable.

So if you’re using something like move to actor, which will cause the AI to run outside their nav mesh, you can just check if a path exists, and if not, stop the AI’s movement. You’ll have to track the AI and whatever the AI is chasing as vector points inside the blackboard though.

It could look a little bit like this:

Best of luck!

Thank you! This is the type of node I’ve been looking for. However I can’t seem to get it to work properly. Here is the BT as it is now, and shows what happens when I run into the radius of the AI on a completely flat cube with NavMesh on it, pathing built:

If I have the Does path exist node set to Inverted, the AI does nothing and gets stuck between “Wait” and “Move To” HomeLocation. I thought this would mean: it checks if a path exists, if it does exist, it will succeed, but be inverted to a fail, fail back up to the Selector, and proceed to the next node under the Selector (the RapidMoveTo tree).

If a path does not exist, it should return fail, invert to success, and proceed to Wait, then MoveTo HomeLocation. But it seems to be the opposite. A path clearly exists between me and the AI, but it gets stuck trying to MoveTo HomeLocation.

What am I missing?

It’s hard to tell without knowing what’s going on in each node, but here’s my best guess.

Self Actor or TargetLocation have not been set. This will cause the Does Path Exist node to misbehave. Still, there’s an easy way to check!

Click on the show dropdown, and under developer, enable AI Debug.
Then, in the editor preferences, go to gameplay debug, and turn on Behavior Tree, and Perception. Then just press the single quote key during game play (this one → ’ ) and it’ll give you a ton of useful debug information.

I just learned about it myself, and it’s amazing!

And here I was assuming SelfActor was something set by default, oops. This seems to have resolved the issue with Does Path Exist not working. That node works properly, now I just need to figure out exactly where to place it to get it work the way I’d like.

You’ve been very helpful! Thank you, Zapheroc.