NPC Stuck At Specific Point While Moving

Guys I am struggling with npc movements. As you can see in images, most of npcs are passing through those points while some of them are stuck at same points at almost every time. (the points they stuck are not the starting points)

At this image, two npcs on the left are stucked while other npcs continued.

Here you can see level:

Of course there is one more example. Here lots of npcs are crossing crosswalk.

But some of them are stuck at this specific point.

Here its level view:

I tried to change location of navmeshvolumes and added navmeshvolumes as obstacles, but failed. Here is details of recastnavmesh:

Thanks for your time, I hope we will solve this problem soon.

2 Likes

Hey @etiq!

Well, the main thing I see is that your actors that are stuck are no longer on the navmesh. That could be a clue.

Try running your game and using

Command (that’s the ` key next to 1) → show navigation

That will show your navmesh during PIE session.

You may want to check if your point can be reached, and isn’t TOO close to that edge. Because they’ll find a point near the navigation point if it’s already identified and you’re using Crowd Detour AI, which might push them off the navmesh and then they can’t move!

Let us know what you find out! :slight_smile:

1 Like

Yeah I can see stucked npcs are out of movable area, I observe that they reach these points while avoiding other npcs. I test the game with high numbers of npcs, even the game will probably have half as much as npcs. When try with lower number of npcs they do not stuck, but I dont want to develop this game with this bug. How can I prevent npcs from reaching out of movable area?

1 Like

You have a few choices here, you can do all for maximum output or a few to keep your project rolling faster.

You could learn the Environmental Query System (EQS) to seek out if the goal location is occupied, and if so, default to nearby locations on the EQS grid.

You could simply use less NPC’s.

You could increase the size of the Navmesh.

Or you could give the moveTo node a higher level of acceptance.

1 Like

Finally I changed the idea of my algorithm. Instead of moving directly, NPCs reach the target location by passing through mid points that prevent them from walking near the edge of paths. I tried to decrease middle of path cost and increase roadside cost through navmeshmodifiers. But failed.

Thanks to new algorithm, at first they determine the points to pass. Then move to points one by one and finally reach the location. Basicly, their paths are such like blue instead of yellow:

(cost of pink areas is lil bit more than default)

Still they stuck roadsides rarely, when 3 or more of them walk side by side. In these cases, changing the position of stuck npcs by little lets them move again.

I am still looking for permanent and accurate solution to prevent getting stuck. There must be solution in the depths of the internet.

1 Like

Yes! This is definitely steps in the right direction and I don’t know why I didn’t think of this…
Just let the navmesh overlap the entire area, but use modifiers and give places like the road a very high cost to walk those places instead of making them unwalkable! Then, if they HAVE to go around they don’t get stuck!

1 Like

I am sorry, this is not the solution. NPCs still getting stuck on the navmesh. Increasing cost of edges may lead them to walk in the middle, but when pushed to edges with high cost while avoding others, they sometimes stuck.

1 Like

Hmm… can you show the settings you have for the navmesh modifier volume blueprint you’re using there? If they’re walking fine on the green and getting caught there at the edge there has to be something there.

You may be better off with one solid navmesh and modifier volumes that say “NO WALKING” on the streets where they shouldn’t walk.

Like as shown here: The magenta is full non-passable, whereas the red and blue change throughout the tutorial.

Also, are you using “MoveTo”? Do you have a Filter Query class set up to use, if you are?