Any way to return to the navigation mesh?

Sometimes bots get out of the navigation mesh and then can no longer move.
As for example in this case.

Is there a way to detect that the bot has left the navigation mesh?..
And force the bot to return to the mesh?

Because many times it gets stuck in the worst possible place.

It would be wonderful to be able to get it out of the way.

Thank you so much!!

Hi, I think it can still move with directly move to. So you could find the ‘best’ point that is inside the navmesh and directly move towards that. To find such a point, you could use an EQS query (generate points on the navmesh) and then score or filter them by e.g. Z-Distance and Distance.

To check whether it has left the navmesh, you could try to project the bots location to the navmesh using ProjectPointToNavigation (with only some Z-Distance in the query extent), if that fails then it should be outside the navmesh.

Not sure whether that will work with the navlink though, since there it can be outside the navmesh while moving.

1 Like

First, this typically happens when you haven’t configured the navmesh correctly for your AI character capabilities (appropriate radius, appropriate path planning, etc.) You may want to adjust the navmesh (and maybe add invisible blockers) until this doesn’t happen.

Second, you can store the last point the character was on the navmesh inside an occasional tick(), and return to that point if the character ever finds itself outside the mesh.

2 Likes

Hi @chrudimer
Thank you very much for your response.
Yes, what you say works in most cases.
I found this thread that was very helpful and also very related to your solution.

However, in this specific case it doesn’t work…

The pawn is in the air.
The capsule is stuck on the edge of the wall.
And below the pawn there is a navigation mesh.

I think this specific case could be solved with a slippery capsule.
If it doesn’t get stuck on the edges maybe works…

I’m going to try this too…
https://www.reddit.com/r/unrealengine/comments/a8qi8t/how_to_get_rid_of_slipping_off_edges/
Any other ideas are welcome.

Thank you very much for your help!! :heart:

Hi @jwatte

I’m going to adjust the NavMesh parameters.
And I am going to implement a service to save the last navigable point.
I hope I can get the capsule not to get stuck on the edges of the walls as well.
I’ll let you know if I managed to fix it.

Thank you very much for your help!! :heart:

Seem this fixed the capsule stuck problem in the wall edges.
It is a property of Character Movement Component.

Perch Radius threshold:
Captura de pantalla 2024-04-15 102608

In my case puting the same radius as the Capsule Component seems to work perfect.

Now, I’m going to implement and test the solutions given by @jwatte and @chrudimer to return to the NavMesh.

I’ll let you know about it.
Thank you so much !!

Hi @jwatte and @chrudimer

I was testing a few days your solutions and both were very helpful.
Thank you very much for your help. :heart:


THE SOLUTIONS:


Solution 1:


Solution 2:


Solution 3:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.