I have a simple AI that needs to path to a random point. It successfully paths to the point however it will get stuck on corners, especially when pathing around a jutting section of wall. My AI is a large ball with a radius of 160.0f. I have set the Agent Radius in Project Settings…->NavigationMesh->Agent Radius to 160. I have also adjusted the movement capabilities of the character movement component of the AI so that the nav agent radius is 160. However, the AI will still get stuck on corners. Bellow is an example of the AI getting stuck:
I am using a custom AI Controller based in C++, however, it is very basic and inherits from the provided AIController. I am also using AI MoveTo to command the AI to move to the random point. Any one know of a solution to fix this issue?
It’s hard to be sure from just an image, but it looks like for whatever reason your navmesh is just not generating correctly for the given radius. That margin between wall and green navmesh polygons should equal the radius, so that if you position the ball such that it’s touching the wall, it should be sat right on the edge of the polygon.
I’ve found the editor navigation settings a little confusing and settled on ignoring those under NavigationMesh in favour of adding an entry to the Supported Agents section at the bottom of the Navigation System category. Maybe give that a go instead.
Also, I’m not sure if the generation is inherently conservative, or if it’s possible that the resolution of the nav mesh could cause these issues sometimes. So it might not be a bad idea to set the supported agent radius slightly larger than the actual radius of your sphere.
Thanks for the answer! I have resolved the issue and the solution was exactly as you say. The Recast-NavMesh was not generating properly. Nor was the AI successfully moving (the action failed due to abort) if I modified the properties of the Recast-NavMesh from the details panel after it had been placed in the level.
The overall fix was to add the correct agent properties to a new entry in the Supported Agents section of Navigation System. As well re-generating the recast nav mesh in the scene via replacing the NavMeshBoundsVolume object. I also had to ensure that, instead of modifying the Movement Capabilities of the Character Movement Component to match the capsule radius/height, the UpdateNavAgentWithOwnersCollision property was checked under the Movement Component section of the CharacterMovementComponent.