Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Jix · May 16, 2015 at 12:27 AM · navmeshnavmeshagentobstacleobstacle avoidance

How to let a navMeshAgent detect if path is blocked by an obstacle?

How can I detect if a navMesh agent can reach a destination that is blocked by an Obstacle?

I have a level where it is already baked to a navMesh, I am using navMesh Obstacles as well. I need the obstacles to prevent the agents from going further in the path, when I give an agent a destination that's blocked by an obstacle the agent tries to reach it but it can't. I would like to let the agent detect that its current destination can't be reached so it doesn't even try.

Thanks

Comment
Add comment · Show 2
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 barbe63 · May 16, 2015 at 12:34 AM 0
Share

Not entirely sure but i think this can solve your issue.

 Nav$$anonymous$$eshPath path = new Nav$$anonymous$$eshPath();
 GetComponent<Nav$$anonymous$$eshAgent>().CalculatePath(destination, path);
 if (path.status == Nav$$anonymous$$eshPathStatus.PathPartial)
 {
    //reset a path
 }

avatar image Jix · May 16, 2015 at 09:08 AM 0
Share

I tried to use your solution in Unity 4 and it wasn't working for Obstacles, it always gave me PathComplete. But I just tried it now in Unity 5, it's working great. Thank you

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by xxxSMDxxx · May 09, 2017 at 05:20 AM

Have you tried the Carve property in the Nav Mesh Obstacle Component. Carve will destroy part of the navmesh where the obstacle is. But rebuild it when it's not there.

Comment
Add comment · Show 1 · 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 Jix · May 09, 2017 at 10:18 AM 0
Share

Hi, I don't mean to be rude, I really appreciate your help but did you read the question? Back then I was using Nav$$anonymous$$esh Obstacle already and the problem was that I wasn't able to know if a path is blocked by an obstacle or not. One comment showed me the solution. This is a pretty old question too.

Again I really appreciate your help and I'm sorry if I'm sounding rude :)

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

21 People are following this question.

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

Related Questions

Toggling NavMeshAgent and NavMeshObstacle 2 Answers

Navmesh carving causing issues upon enabling navmesh agent component 0 Answers

Way to ignore specific navmeshobstacles for specific navmeshagent when creating path? 0 Answers

Unity NavMesh obstacle avoidance? 0 Answers

Trouble with Navmesh Agent and Navmesh Obstacle 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