reeseschultz / ReeseUnityDemos

Unity packages and demos—emphasizing ECS, jobs and the Burst compiler—by Reese and others.
https://reese.codes
MIT License
516 stars 45 forks source link

UnityEngine.Experimental.AI throws errors due to overlapping or touching surfaces #82

Closed zlxt2714 closed 3 years ago

zlxt2714 commented 3 years ago

Bug description:

  1. When the number of walking planes exceeds 2, or the number of planes exceeds 2, an AABB error will be reported when the agent reaches the end point(NavDestination point)

you can copy your Surface and move it to the right ,and remove the wall ,bake a new suface data and test it .

Bug reproduction:

82

83

  1. When I don't want to using the flocking effect, there is no mutual avoidance between agents

https://user-images.githubusercontent.com/58289522/131828910-625a2c8d-9242-4156-a292-f2fea7973e2a.mp4

I need your help

reeseschultz commented 3 years ago

Okay, so there are two issues here, if I understand correctly.

  1. One is that overlapping surfaces present AABB errors, presumably in one of the destination systems.
  2. The other issue is that non-flocking agents do not avoid each other.

As to the first issue, one easy solution is to use a single mesh. You can either write or find a script to merge the meshes and bake them, or, preferably, just create a single mesh in Blender, or whatever your preferred 3D editor is. Would that resolve your issue?

As to the second issue, avoidance depends on flocking. The only way the agents can avoid each other is by flocking. No other avoidance strategies come with this code.


If you can't get what you need from my navigation package, you may want to look into Godot 4's navigation server.

zlxt2714 commented 3 years ago

You understand very well. Thank you for your reply. My scene is very complex and there are a lot of models. Using a single mesh is not realistic. Where can I find a script to merge these meshes. can you give me a URL?

reeseschultz commented 3 years ago

You're telling me that using a single mesh isn't realistic? Are you generating surfaces at runtime? If not, using a single mesh is entirely realistic.

I'm unaware of a one-size-fits-all script for runtime meshing. You can find examples with a search engine, some paid, some free.

reeseschultz commented 3 years ago

Also, FYI, I can reproduce this issue, but I'm unsure when it will be resolved. This may be a bug in UnityEngine.Experimental.AI, not my code, which is why I'm suggesting workarounds. I'll need to take time out of my work to look at this.

reeseschultz commented 3 years ago

Unfortunately, I'm 99% this is a Unity bug, and I can't do anything about it other than switch to a different DOTS-compatible navmesh API. Since none exist, we'll have to wait for Unity to update or replace UnityEngine.Experimental.AI.

Their non-commital roadmap includes this relevant item:

Progressive Rearchitecture: Queryable navigation model An enhanced set of API methods for querying the navigation data in greater detail than before, compatible with Unity’s Job System. The results include connectivity and geometry information about all the nodes in the navigation graph, and any other details necessary for implementing a pathfinding algorithm.

Looks like they intend on making my life much easier. In following this roadmap, one of the first things they did was start publishing https://github.com/Unity-Technologies/NavMeshComponents as a package, meaning I need to stop embedding its code directly in this project...


Anyway, I don't believe I can do anything about your issue @zlxt2714. You're welcome to reach out to Unity. Whether you do or not, the workaround is clear: you need a single mesh for navigation.

You may want to look into Mesh.CombineMeshes. That's probably the easiest way to combine surfaces at runtime, although it won't cull duplicate polygons in the case of overlapping surfaces.

I'm closing this for now, unless someone has a solution that involves a simple code change to the nav package.

zlxt2714 commented 2 years ago

When I was using your Reese.Nav, I encountered a problem. When the target point (NavDestination (WorldPoint))is far away, the agent does not move to the target point. How can I modify the settings and where can find the settings file ? Thank you for your answer

------------------ 原始邮件 ------------------ 发件人: "Reese @.>; 发送时间: 2021年9月2日(星期四) 晚上11:51 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [reeseschultz/ReeseUnityDemos] [BUG]the number of planes exceeds 2, an AABB error will be reported when the agent reaches the end point(NavDestination point) (#82)

Closed #82.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.