Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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! This 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
5
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

Thanks, that was exactly what I needed!

avatar image willaay96 · Nov 14, 2017 at 09:44 PM 0
Share

Sorry to be stupid, does that mean adding the nav mesh obstacle to each "character" or moving unit, as opposed to every "house" or stationary object?

avatar image gwynblade willaay96 · Nov 15, 2017 at 02:47 AM 0
Share

What this means is, if you have an object (say, a house) that should block movement of an agent (say, your player character), AND that object could possibly move or be destroyed, then you add the Nav$$anonymous$$eshObstacle component to that object. This is because any obstacles that DON'T move or get destroyed should be marked as static so the navmesh is baked with them in $$anonymous$$d. If such an object were destroyed, the navmesh still contains a "hole" that the player could not traverse, because the navmesh doesn't get recalculated at runtime. As Danteswap mentions below, you'll want the "carve" option checked.

avatar image GreatCorn · Jul 14, 2018 at 08:26 AM 0
Share

Nav$$anonymous$$esh obstacles can't pass through walls which can be a problem when making sliding doors

avatar image
1

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

This just makes them permanently impassable. I want units to be able to walk through where they were once the objects are destroyed. Thanks though!

avatar image Nanofication gwynblade · Feb 03, 2016 at 03:24 PM 0
Share

Ah I see, sorry about that.

@servival 's answer does satisfy your issue then.

avatar image
0

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.

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

Navmesh y-axis 1 Answer

Navmesh agent got fused in very crowded situation when colliding. 0 Answers

How to have a navmeshagent not move rigidbodies in my world? 0 Answers

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


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