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
0
Question by rbarbosa · Feb 28, 2013 at 01:12 PM · pathfindingnavigation

Do your NavMeshAgents choose different paths in the editor?

Hey folks...I'm having a strange problem that occurs periodically that I can't really seem to pin down.

I'm using Unity Pro's navigation mesh and agent to make my scene walkable.

I have a "maze" of roads that fan out from one of two peripheral locations (the red side of the map and the blue side of the map). Those roads lead to intersection points where targets are and ultimately they lead to the other side of the map.

Part of my game mechanic is that players pick a road to traverse to try to reach the other side. The agents stop at any intersection where a target lives and do what they can to destroy it before moving on to the opposing team's side of the map.

The game is played asynchronously, so I record what choices the player made on the server and replay them when the opponent logs in to the game. 9 times out of 10 this works fine and the replayed navigation choices are the same as when the player originally made their move. But often (and mostly in the Unity Editor) the agent chooses a different path and will end up getting stuck. In fact, the agent will often go down a dead end path where the navigation mesh is broken and it will pin itself in a corner.

This leads me to 2 questions:

  1. Why would the agent make a different choice in the editor than it makes in the live game?

  2. Why would the agent choose to go down a non-connecting dead end path with no hope of ever reaching its goal?

I believe Unity's navigation system allows me to put a cost on a road...but I don't really think that's what I want to do. I don't want to force a road choice...or make one road preferential over the other. I want the AI to choose the shortest path. But it seems as though there is some flaw in the logic that causes it to play differently.

I currently have a saved game on my server wherein if I load the game on my iPad or in the Web Player, it fairly consistently chooses the right path (although not 100% of the time), but when I run the game in the editor it fairly consistently chooses the wrong path and the bot gets stuck.

Are there any parameters of the agent that make the navigation decision "fuzzy" that I can tweak to eliminate the fuzziness?

What I've been doing to manage the problem is creating "breadcrumbs" along the path that I want the AI to follow. This urges them down the path I want them to take in shorter increments, but it also requires me to manage these breadcrumbs which can be painful when I change the scene geometry or add and remove new targets. Also, it doesn't really solve the problem...sometimes the bots get stuck en route to the next breadcrumb. :-/

Thanks in advance for any guidance.

Comment
Add comment · Show 1
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 rbarbosa · Mar 03, 2013 at 05:21 PM 0
Share

So...another wrinkle for this question (which seems to be stumping the community as well as it's stumped me)...I have added a feature to my game wherein when the player highlights a spawn point, a marker gets created and follows the path that the agents spawned from that location will take to reach their destination.

The problem is this...when the marker gets spawned...it immediately takes a "wrong turn" choosing a different path than the actual agents that are spawned from that location will take. I've checked all the properties of the nav mesh agent to ensure that its radius is not so big as to create an "obstruction" on the path. I've set its parameters to be the same as the actual game objects that get spawned from that location, and still, 100% of the time, it chooses a different path.

Does anyone know of a way to make the navigation/pathfinding more deter$$anonymous$$istic?

0 Replies

· Add your reply
  • Sort: 

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

9 People are following this question.

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

Related Questions

Navigation Mesh not working in build 0 Answers

Increase size of obstacle - navmesh 1 Answer

How to build a custom shape NavMesh Area 1 Answer

Object reference not set to instance of object - Can't find solution. 1 Answer

Put (Instantiate) Gameobject along or accross a path 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