Why the enemies not following the path but inside instead?

I check all the code and they are all fine, can anyone help with it? Thanks

They are just cycling in the path

Hey @sky_kwan , can you post a screenshot of your NavMesh Agent from your enemies? I think you have the stopping distance set too high.

Because we’re not going precisely to the location of the waypoint (you can’t, the NavMeshAgent will always overshoot it a bit and your character will spin in circles), we have to use a certain amount of acceptance radius to decide if we’re close enough. Given any enclosed polygon, whenever we approach the points but never truly reach them, moving on to the next waypoint instead when we’re close enough, we will always describe a path that is inside the polygon.

If the waypoints are too close together, this will almost always result in the behaviour you’re describing. At no point will the character actually walk on the line because it’s starting point was never on the line to begin with.

There are tricks you can pull to force the character onto the line… for example: the line could intersect a fence where the only path through the fence is on the line.

The simplest solution is to ensure that your patrol path points have more separation. You’ll never be truly on the line, but the movement should look more natural.

1 Like

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