Agent not getting past corners!

Hi - how can I avoid this from happening? The radius doesn’t seem to be taken into account when calculating paths and my agent’s path is dipping into unwalkable nodes?

The agent often gets stuck no matter what settings i use. Any help appreciated! (Screenshots below)



Hi

All points on the navmesh should be valid points for the center of the character.
In this case I would recommend that you raise the Grid Graph → Collision Testing → Diameter setting. And you may want to increase the node size as well.

Ok thanks - the reason I have the node size this small is because I’m using erosion as a workaround because of this issue:

My agent thinks that a node that is too high on the y-level is walkable, when it isn’t. I have a scene of cubes and the second layer of cubes should be too high and unwalkable, but it returns reachable and the agent just walks into the wall and walks on the spot forever! I’m using the layered grid graph because I assumed this was used for this use case?

Sure. If you need a small node size for that, that’s fine.

Ok thanks, but can I ask why is the path is still intersecting unwalkable nodes?

Your radius offset modifier seems to be too aggressive in this case. That modifier is really only appropriate in a few use cases where the radius is relatively small, and it will not be great at keeping agents a significant distance away from walls.

Ok, so I’ve removed the radius offset modifier and doubled the collision diameter on the grid settings to 2, and still we are hugging the walls so much we get stuck on corners?

You also have a SimpleSmoothModifier which seems very aggressive. Try to reduce the max segment length on it, or disable it altogether.

Ok, removed it altogether and the agent is still casting paths on unwalkable nodes and trying to walk through walls. It’s creating the weirdest routes to get to a location.


Are you sure you removed the radius modifier? It doesn’t look like it.

Oh yes, that was my mistake. With all modifiers removed we’re still getting stuck on corners though?

In that case, you should increase your erosion iterations or the collision diameter check.

The rule of thumb is that the agent’s center should be able to stand on any point on the graph (the blue part).

Increasing collision beyond 2 renders the ground unwalkable.

Increasing erosion iterations essentially means doubling the graph size, which I’m not sure about, but I’ll try it.

It might be hitting a collider below the graph.

Not sure what you mean by doubling the graph size? Erosion has nothing to do with the graph size.

Because if the erosion is at 2, a 2x2 cube will be un-walkable. So I’d have to double the graph size to have walkable cubes. I’ve attached current grid settings but my character is still getting stuck - collision diameter is at 4 now: err-11 - Album on Imgur

Hi

Btw, are you sure you don’t want to use 2D physics for this? Now it looks like your collision check is barely hitting anything. It looks like everything is 2D, but you are using 3D collisions for some reason.

It’s 3D, I’m just showing you the topdown view. I just want my character to move smoothly around this simple environment without running into walls or being caught up on corners. I would eventually like to add ramps for hte character to traverse the second layer of cubes.

Ok

I think your ground is not included in the collision testing layer mask. Make sure it is, and that the offset is high enough that the collision check is done slightly above the ground.

If you want your character to be able to move smoothly along a corridor which is 2x2 meters wide (1 tile in your world it seems), then your character must be narrower than 2 meters in diameter. Right now, it seems your agent is 2 meters in diameter, which will inevitably cause it to get caught on corners if it tries to make even a slightly smooth turn.

Ok, you mean the AIPath Radius setting?

No, you have a collider on your agent.