Navmeshagents, Character Controllers and Colliders

Hi all,

I’ve ran into an issue with my First Person type game where I have two ‘actors’ in a scene.

Actor 1 - An AI with a NavMeshAgent attached that uses a Sphere collider. The Sphere collider is a trigger that takes the transform of an Actor 2 that enters the collider and sets that as the NavMeshAgents destination.

Actor 2 - A player controlled object that has a Character Controller with a movement script that’s pretty much based on the script example here:

Both actors also have a small cylinder meshes as mock models.

The problem I am having is that Actor 1 and Actor 2 can walk through each other, which I don’t want. I want them, when they collide, to prevent each other from walking into each others cylinder meshes.

I have tried adding NavMeshAgents to Actor 2 but I find that the NavMeshAgent and Character Controller conflict with each other and the player starts jittering up and down the Y axis. I’ve also tried adding Rigidbodies to both Actors but the Rigidbody on Actor 1 conflicts with the NavMeshAgent (again) and causes odd behaviour in the movement of the AI.

It feels like I am not following best practices in player controllers and NavMeshAgent as well as setting colliders correctly, so any advice would be great.


AngryAnts feedback in this forum thread gave me the answer I needed.

Basically, rather than use the Character Controller component for movement, I can use the move method on the NavMeshAgent to move the player around. After doing this both actors collided correctly without issue, but the player movement wasn’t broken.