• 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
2
Question by gwynblade · Feb 02, 2016 at 09:02 AM · unity 5collisionnavmeshnavmeshagentnavigation

How do I get NavMeshAgents not to walk through objects?

Hey, everyone! T$$anonymous$$s is my first question on the Unity Forums!

So, I have a NavMeshAgent attached to a player-controlled unit. When the player clicks a valid target, the unit moves towards that target on the NavMesh. However, if I try to give it a target on the other side of an obstacle, the agent just goes right through it! I've messed with colliders, rigidbodies, and isKinematic, but to no avail.

The inspector for the Infantry unit

The inspector for the wall

[1]: http://answers.unity3d.com/questions/659652/navmeshagent-collision.html

wallinspector.png (35.1 kB)
infantryinspector.png (56.4 kB)
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

3 Replies

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

Answer by servival · Feb 02, 2016 at 11:36 AM

You need to add a nav mesh obstacle component to your non-static objects.

Comment
Add comment · Show 4 · 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
avatar image gwynblade · Feb 03, 2016 at 06:37 AM 0
Share
avatar image willaay96 · Nov 14, 2017 at 09:44 PM 0
Share
avatar image gwynblade willaay96 · Nov 15, 2017 at 02:47 AM 0
Share
avatar image GreatCorn · Jul 14, 2018 at 08:26 AM 0
Share
avatar image
2

Answer by Nanofication · Feb 02, 2016 at 05:32 PM

For your obstacle, try

1) Going to navigation tab

2) Go to the object tab of the navigation tab

3) Select Navigation Static

4) Go to Navigation Area change Walkable to Not Walkable

5) Click Bake (Rebake the NavMesh)

Comment
Add comment · Show 2 · 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
avatar image gwynblade · Feb 03, 2016 at 06:37 AM 0
Share
avatar image Nanofication gwynblade · Feb 03, 2016 at 03:24 PM 0
Share
avatar image
1

Answer by danteswap · Nov 14, 2017 at 10:51 PM

On The Obstacle Add NavMesh Obstacle Component Now Choose Desired Shape For Obstacle , I would Suggest To use Box , Now Adjust The Size So That the It Covers Your Obstacle Object , For Now To Test Just Use Value Of 2 In all X,Y,Z And Enable The Carve Option . Now In The Scene You Can Try To Move Your Obstacle And You Will See The NavMesh Around The Obstacle Gets Modified . Now Play the Scene And Give Target to Your Player And in Scene View bring The Obstacle In front Of Player . now It Will Not Go Through The Obstacle but Will Find New Path . Again For Fun You can Move Obstacle In front Of Player And Player Will Find New Way to Reach The Target . have Fun

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

Enemies using navmesh are bumping each other through solid objects 1 Answer

What is the difference between configuration of agent in 'Agents' tab and in 'Bake' tab Unity? 1 Answer

Navmesh y-axis 1 Answer

All my NavMeshAgents are tilted 1 Answer

Navmesh agent got fused in very crowded situation when colliding. 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