- Home /
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: http://docs.unity3d.com/Documentation/ScriptReference/CharacterController.Move.html
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.
Thanks, Mark
Answer by mwinteringham · Aug 25, 2012 at 09:57 PM
AngryAnts feedback in this forum thread gave me the answer I needed.
http://forum.unity3d.com/threads/130012-Need-Advice-or-Recommendations-with-NavMesh-and-Agents
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220613080004im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Colliders Not Working 1 Answer
Character Controller vs moving platform 0 Answers
Multiple Colliders 1 Answer
Aircraft Control 1 Answer
FPS Character Controller with the push DOWN rigidbodies ability 0 Answers