Problem
I have created a navigation system using Rigidbody and NavMesh. There is an agent that tries to follow me around. It has a capsule collider, a script (see below), a Rigidbody, and a NavMeshAgent component. It works by running the NavMesh calculations, getting the coordinates for the next place to move, disabling the NavMesh, and moving there using MovePosition()
. This system works pretty well usually, but lately I have been experiencing problems. When the Agent moves around an obstacle, it pauses on the corners. I believe the reason for this is my code, especially my MovePosition()
function, but I don't know how to fix it.
Open the Bake tab and set your agent's radius and height according to its dimensions. At the bottom, click to expand Advanced options. In that, there's a field Min Region Area, increasing the value increases the area around the static obstacles where the navmesh agent cannot move.