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
1
Question by Pizzaboy10 · Feb 02, 2018 at 01:20 AM · navmeshagentnavigationobstacle avoidance

Instantiating a nav mesh obstacle makes all current nav mesh agents try to walk through a wall.

In summary, I am making a game with tower-defence elements, with creeps that use a navigation mesh to pathfind their way to the enemy base. The main issue is, when I create a tower that's nearby the path they would take, most of the creeps try to just turn around and try to force themselves through a wall, until they get pushed out by some other creep trying to do the same thing.

The towers have a Nav Mesh Obstacle component with "Carve" enabled (because otherwise they'd just stop in front of said tower), and I feel that it's re-generating the polygons that the navmesh is made of, and in that frame, the creeps AI just breaks. I have no clue how to fix this problem, any assistance or advice would be greatly appreciated.

Here's a video showing the problem, for those that need to see the issue to understand it (I wouldn't blame you).

https://www.youtube.com/watch?v=gAUSyAovHjE&feature=youtu.be

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 Yukumura · Dec 31, 2018 at 11:27 AM 0
Share

Hi @Pizzaboy10,

I have the same problem. Have you solved in any way?

avatar image Pizzaboy10 Yukumura · Jan 01, 2019 at 09:23 AM 0
Share

Sorry but i have not. I dropped this project after not being able to fix this issue long ago. I had briefly considered forcing a navmesh grid to be split into squares of the same size of my towers but couldn't figure that out.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Harinezumi · Feb 02, 2018 at 05:02 AM

Hi!
Seems like creating a navmesh obstacle with carving at runtime invalidates the existing paths. You can try setting carve only stationary on, or disabling carving, or tell all of your navmesh agents to calculate a new path (with SetDestination()) when you place a new obstacle. I don't know if either will help, but based on my experience with navmeshes these could solve the issue.

EDIT
As none of these suggestions seem to help, maybe you can look into Unity's NavMesh Components which extends the navmesh functionality, or completely switch over to the A* star project (you don't have to buy the pro, the free version is already useful enough).

Sorry I can't give you better advice, I've been working with navmeshes for 2 years and they still don't always do what I want them to do (I'm looking at you, distance from destination logic >:( ).

Comment
Add comment · Show 3 · 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 Pizzaboy10 · Feb 02, 2018 at 05:22 AM 0
Share

Thanks for the reply. I would disable carving, but then the creeps would just mush up against the tower ins$$anonymous$$d of going around them. As for SetDestination(), I added that to a key input and nothing seemed to change when I pressed it. I guess whatever causes the agent to decide on a path still thinks going into the wall is the right path.

Slight side note: I tried moving the whole floor and walls thing over a little and the creeps acted in a similar manner, just in a different place. Still no idea why.

avatar image Harinezumi Pizzaboy10 · Feb 02, 2018 at 05:30 AM 0
Share

Try also turning on Carve only stationary (I guess your tower is stationary anyway). I know I had weird behaviour with my navmesh obstacles if Carve only stationary was off, even if they were already present at the beginning.

avatar image Pizzaboy10 Harinezumi · Feb 02, 2018 at 05:45 AM 0
Share

Carve only stationary is on by default. I tried turning it off just for the sake of it, but no difference. I think this might be an issue I can't fix myself.

avatar image
0

Answer by ray2yar · Dec 31, 2018 at 02:21 PM

I'll suggest something that will work but it WON'T be performant. You can use a navneshsurface, and rebuild the navmesh each time a new tower is placed. There will be a noticeable stutter if you have a large play area with a high resolution. You'd need to change your towers to "not walkable" and take off the obstacle component. If the user places alot of towers sequentially there'll be a larger stutter.

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

78 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 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 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 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

Unity NavMesh obstacle avoidance? 0 Answers

NavmeshAgent and NavmeshObstacle and Bake don't work with AICar 0 Answers

NavMeshAgent: How to set perception radius? 0 Answers

How to make the enemy avoid each other 1 Answer

RTS Helocopter Unit: Navmesh Obstacle Avoidance 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