Some questions about AI and Navmesh (blueprint)

Hi everyone,
I just start to use Unreal engine and I got into some issues regarding AI and NavMesh in blueprint.

My goal is to make a AI character go straight forward, and if can’t move (block by a wall, a box, reach the border of the navmesh…) he just do a 180° rotation and go away.

To do that, I tried to use the “AI Move To” with a moving target in from of the character. The target location is refresh every tick (for now) and if the target is not reachable, I change the target to the other side of the character.

My first problem is the navmesh configuration, I changed the cell size, agent radius, … but when I press play, it seems that an other navmesh appears. And the navmesh used by the actor seems to be the wrong one (the small one).

I saw there is also those options in the Project settings, I tried to change them but the problem is still there.

My other problem is I don’t know how to detect that the target is out of the navmesh.
On this picture, the target is the black dot, the cube is not moving anymore but the “Is Valid” method for the path still return true.

How can I get a value that say “The target is out of the navmesh” so I can change my direction.

Thanks a lot.

AI navigation is not an easy topic, so there is much to consider with your problems and how you decide to handle them as it can lead to problems as you move forward.

The multiple nav meshes could be caused by a number of reasons. And the engine allows for multiple. My guess would be having more than one navmesh bounds volume or else multiple recasts in your world outliner. The offset different between the two makes me guess it’s something to do with recast - delete any/all of them and rebuild, hope that fixes it.

As for being blocked by something, the use of a trigger could help. This could be next to the wall and when the enemy overlaps it, they are rotated 180 then told to move back to their original starting position.

I suggest something simpler than AI as you begin to learn the engine. Stick to things the player can do/things done to the player so that you can learn more about how the engine is set up to deal with common situations.