• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by mwinteringham · Aug 21, 2012 at 08:48 PM · rigidbodynavmeshcolliderscharacter controller

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

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Colliders Not Working 1 Answer

Character Controller vs moving platform 0 Answers

How to make colliders and character controller green outlines visible? 1 Answer

Having problems with playing a sound (C#) 2 Answers

Navmesh and Rigidbody Causing Camera Jitter 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges