NavMeshAgent Avoidance in Depth - 5 Key Takeaways for Optimal Avoidance | AI Series Part 32

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 มิ.ย. 2024
  • Learn how NavMeshAgent obstacle avoidance works... in DEPTH! In this deep dive into NavMeshAgent avoidance you'll learn 5 key takeaways for improving NavMeshAgent avoidance using the Unity Navigation System - no external assets needed!
    Learn how:
    ⚫ NavMeshAgent Avoidance Quality influences avoidance
    ⚫ NavMesh Prediction Time values influence Agent avoidance
    ⚫ NavMesh Pathfinding Iterations Per Frame impacts NavMeshAgents
    ⚫ NavMeshSurface Bake Settings influence Agent pathfinding and avoidance
    💸 Ongoing sales 💸
    ⚫ See all active asset sales on the Asset Store: assetstore.unity.com/?on_sale...
    ⚫ Save 25% off your first Asset Store Order: prf.hn/click/camref:1101l9QvC...
    ⚫ Save up to 50% on NEW Assets: assetstore.unity.com/?new_sal...
    👨‍💻 As always, all code from this video is available on GitHub: github.com/llamacademy/ai-ser...
    ❤ Believe in LlamAcademy's mission and have received value from the videos? Become a Patreon Supporter or TH-cam Member:
    ⚫ Patreon: / llamacademy
    ⚫ TH-cam Member: / @llamacademy or click the Join button on any video
    📚 Resources
    ⚫ Most of the configurations are on the NavMeshAgent itself:
    docs.unity3d.com/Manual/class...
    The higher level configurations such as the pathfindingIterationsPerFrame can be set at the
    ⚫ NavMesh class: docs.unity3d.com/ScriptRefere...
    ⚫ NavMeshSurface component: docs.unity3d.com/Packages/com...
    ⚫ RVO2: gamma.cs.unc.edu/RVO2/
    ⚫ RVO: gamma.cs.unc.edu/RVO/
    As usual with the AI Series, we're using the NavMesh Components: docs.unity3d.com/Manual/NavMe... not the built-in navigation system.
    ----
    Most tutorials come from knowledge gained making survival.llama.software Llama Survival - a top-down zombie survival shooter for Android and iOS.
    I also have some Unity Assets (affiliate link): assetstore.unity.com/publishe...
    Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
    #unitytutorial #tutorialtuesday #gamedev #tutorial #unity #llamacademy #gamedevelopment #ai #navmesh #avoidance
    Chapters:
    00:00 Avoidance in Unity Overview
    02:33 Scene Overview
    03:55 1:1 Scenarios - Avoidance Observations and Debug Visualization Understanding
    07:45 Circle Scenarios - Why Doesn't Avoidance Always Work?
    13:42 Narrow Pathway Scenarios - Problems Exacerbated and a Surprising Solution
    19:50 5 Key Findings

ความคิดเห็น • 77

  • @BlueHat1
    @BlueHat1 ปีที่แล้ว +3

    Thank you so much! This is exactly what I was looking for.

  • @ronigleydsonvilasnovas8067
    @ronigleydsonvilasnovas8067 2 ปีที่แล้ว +25

    I think it would take me years to learn so much valuable information about AI and unity, you've made it so much easier and fun. thanks for the new tutorial.

  • @INeatFreak
    @INeatFreak ปีที่แล้ว +5

    This channel is a hidden gem. Hope you get the recognition you deserve.

  •  2 ปีที่แล้ว +3

    Very good video, loved the detailled options and visualisation, it made things so clear, thank you !

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +1

      Thanks! I'm really glad it helped!

  • @B4NTO
    @B4NTO ปีที่แล้ว +1

    Will have a look at this tomorrow :D thanks for making this!

  • @JoeCoo7
    @JoeCoo7 2 ปีที่แล้ว +2

    Imho the best video of your series. Thanks for making this. Much appreciated.

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว

      That's powerful! Thank you I appreciate the feedback

  • @tufanaydin6340
    @tufanaydin6340 10 หลายเดือนก่อน +1

    I just discovered your channel. You make very nice videos. I can find everything I need specifically. You are amazing and very sincere.

  • @DmitryKhutornoy
    @DmitryKhutornoy 2 ปีที่แล้ว +3

    thank you so much! Your lessons are very helpful!

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +1

      You're welcome! I learned a lot on this one myself!

  • @Argenuto
    @Argenuto หลายเดือนก่อน +1

    Excelent... No words can describe the quality of this video. THANK YOU!!

  • @impactsuit9871
    @impactsuit9871 ปีที่แล้ว +1

    Great channel, by the way, helped me a lot, thanks!

  • @zsomborrozsa1086
    @zsomborrozsa1086 2 ปีที่แล้ว +2

    Thank you so much! This was the only thing that was bothering me! My player pushed the enemy before killing it, but now I could solve it. Good luck in the future!

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +2

      That's great to hear!

  • @marcjukil300
    @marcjukil300 2 ปีที่แล้ว +3

    Waou, this is very high quality content !

  • @cyco3oy
    @cyco3oy 2 ปีที่แล้ว +2

    Awesome!

  • @styliann
    @styliann 2 ปีที่แล้ว +1

    This is excellent work.

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว

      Thank you very much 🙏!

  • @lonelycrescendo
    @lonelycrescendo 2 ปีที่แล้ว +2

    Omg this is the coolest video ever!!!

  • @brandonjacksoon
    @brandonjacksoon 2 ปีที่แล้ว +3

    Greetings from Reddit ;)
    Liked and subscribed!
    Thanks for interesting content!

  • @poobagification
    @poobagification 2 ปีที่แล้ว +6

    All those zombies trying to pass each other was very satisfying to see

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +1

      Some of the visualizations were pretty cool. I reran a lot of them multiple times just for fun

  • @maxpanic3633
    @maxpanic3633 2 ปีที่แล้ว +2

    OH MY GOD WHY DOES IT HAVE LESS THAN 10K VIEWS, SOMEBODY EXPLAIN PLZ
    Great tutorial ! Thank you very much I think I will binge watch the whole serie right now, and you got a new subscriber ;)

  • @user-rx6zr4hl6u
    @user-rx6zr4hl6u 2 หลายเดือนก่อน +1

    Awesome

  • @iamthebubb
    @iamthebubb ปีที่แล้ว +1

    This is perfect. Now I don’t need to program all this!

    • @LlamAcademy
      @LlamAcademy  ปีที่แล้ว

      The Navigation system is pretty powerful. Not perfect, but does cover a lot of use cases out of the box!

  • @Jarzykk
    @Jarzykk ปีที่แล้ว

    Thank you.

  • @alperaydin7011
    @alperaydin7011 2 ปีที่แล้ว +2

    Thanks

  • @flurinjenal374
    @flurinjenal374 3 หลายเดือนก่อน +1

    Top video! How does obstacle avoidance impact performance (FPS) for each quality options?

    • @LlamAcademy
      @LlamAcademy  3 หลายเดือนก่อน +1

      On my machine the performance was not significantly different, but you can download the full project on github and deploy to your target device(s) and see how it is on your target hardware!

    • @flurinjenal374
      @flurinjenal374 3 หลายเดือนก่อน

      @@LlamAcademy Great, thanks!

  • @nishadtardalkar8737
    @nishadtardalkar8737 2 ปีที่แล้ว +1

    Hey how did you get the data about the avoidance cells that turn white and red?
    Also the one where which 8 agents its currently avoiding ?
    I wasn't to find it in your github project.

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว

      Great question! That's the built-in debug visualization. If you keep open the "Navigation" window (Window > AI > Navigation), ensure the NavMeshAgent component is not collapsed on the GameObject, and select the NavMeshAgent you should see those controls in the Scene View. There will also be some options at the bottom right of the Scene View to enable different aspects of the debug visualizations.

  • @ChadGatling
    @ChadGatling ปีที่แล้ว

    Are you using the included nav mesh, or the new nav mesh surface? I can't find the avoidance prediction time on nav mesh surface.

    • @LlamAcademy
      @LlamAcademy  ปีที่แล้ว

      The vast majority of these configurations are on the NavMeshAgent. Only towards the end when I go over the advanced bake settings are we dealing with the NavMeshSurface component

    • @ChadGatling
      @ChadGatling ปีที่แล้ว +1

      @@LlamAcademy oh I found it. It's just a static property on NavMesh.

    • @LlamAcademy
      @LlamAcademy  ปีที่แล้ว

      I must not be fully awake. I missed the specific property you were asking about! 😅 I’m glad you found it!

  • @farshatowalex
    @farshatowalex 2 หลายเดือนก่อน

    Why stopped agent with 30 priority is not avoided by agent with priority set to 40? The 40 agent is just not moving when it gets close to 30 agent...

  • @iamarugin
    @iamarugin 2 ปีที่แล้ว

    Could you please share the link to RVO2 website you mentioned?

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +1

      Absolutely! I've added it to the description as well:
      RVO Websites
      RVO2: gamma.cs.unc.edu/RVO2/
      RVO: gamma.cs.unc.edu/RVO/

    • @iamarugin
      @iamarugin 2 ปีที่แล้ว +1

      @@LlamAcademy THANKS!

  • @danil_zz
    @danil_zz 2 ปีที่แล้ว +1

    NavMeshSurface is the answer: we can setup more voxels for narrow places, and only for that place

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +1

      Yup! Towards the end that's touched upon

  • @impactsuit9871
    @impactsuit9871 ปีที่แล้ว +1

    Problem I always have with Navmesh agents avoidance is that it simply does not work if an agent is stopped in front of other agent, they start pushing each other.
    To circunvent it I use the Agent/Obstacle swap method, but it makes everything so much more complicated...
    I tried AStar Pathfinding instead of Unity Navmesh, same problem...
    Is there any other way to make it work?
    I mean, if both agents are moving, RVO works ok, they avoid each other, specially if they are moving against each other, but if the agent in front stop, the one moving behind will simply push it out of its way, as if it suddenly became invisible.

    • @LlamAcademy
      @LlamAcademy  ปีที่แล้ว

      Hmm... As long as the agents have the same priority they should also consider stopped agents. I have tried this many times successfully that agents route around a stopped agent as long as there are not more than 8 nearby to consider. Can you validate your configuration of the agents?

    • @impactsuit9871
      @impactsuit9871 ปีที่แล้ว

      @@LlamAcademy I tried that for months, got really sick of seeing them pushing each other, then I used the obstacle trick...
      Even when the stopped agent had 0 as priority and the one moving 99,simply push each other...
      I tried it with different combinations too
      Tried the Astar pathfinding, the paid version, same results
      Once an agent is stopped, the others simply push it
      Por, perhaps they are pushed WHILE STOPPING, it could be just that, anyway doesn't work...

  • @freecash3474
    @freecash3474 ปีที่แล้ว

    How would I use this system with custom movement system for navmesh? Is it possible?

    • @LlamAcademy
      @LlamAcademy  ปีที่แล้ว

      Hi! Yes you can do custom movement on the NavMesh. You can call SetDestination to calculate the path to a given location, or use NavMeshAgent.CalculatePath() to get a NavMeshPath that represents how to get from point A to point B. You can then write your own logic to walk around on the NavMesh with fully custom code, or using NavMeshAgent.Move().
      Depending on your use case, it may be better to use A* and something like RVO2 agent than to try to monkey with the NavMesh APIs and doing custom movement.

  • @ChadGatling
    @ChadGatling ปีที่แล้ว

    I saw the other comment on this but I still can't see the obstacle avoidance visualizer. Is there something I am missing to get it to show?

    • @LlamAcademy
      @LlamAcademy  ปีที่แล้ว

      You need the Navigation window open and to have the NavMeshAgent selected to have that show up

    • @ChadGatling
      @ChadGatling ปีที่แล้ว

      @@LlamAcademy hmmm... I did that and it wasn't showing. It's not important I just wanted to see it.

    • @ChadGatling
      @ChadGatling ปีที่แล้ว

      @@LlamAcademy Actually I'm not sure what I did but I did get the option to show up in the corner. Thanks

  • @onesoldiergame4863
    @onesoldiergame4863 2 ปีที่แล้ว +2

    How is the performance on mobile?

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +1

      In my game I have over 100 active agents with avoidance on "low" and it runs very fast. I'm GPU bottlenecked all of the time.

    • @flurinjenal374
      @flurinjenal374 3 หลายเดือนก่อน

      @@LlamAcademy How is performance on mobile with higher avoidance types such as "good" or "high" quality?

  • @todkahler2092
    @todkahler2092 3 หลายเดือนก่อน

    This doesn't work if you want your enemies (the nav agents) to just be different instances of the same prefab, as enabled is a extern variable. So when you disable one agent you end up disabling them all.

    • @LlamAcademy
      @LlamAcademy  3 หลายเดือนก่อน

      I’m not sure I’m following you. Can you elaborate?

  • @metal_burn
    @metal_burn 3 หลายเดือนก่อน

    to 4to nado

  • @DanyloSyrotynskyy
    @DanyloSyrotynskyy 3 หลายเดือนก่อน

    Hello! We have bugs with navmesh agents a lot colliding each other, how to fix it?

    • @LlamAcademy
      @LlamAcademy  3 หลายเดือนก่อน +2

      That's what this video addresses 🙂

    • @DanyloSyrotynskyy
      @DanyloSyrotynskyy 3 หลายเดือนก่อน

      @@LlamAcademy ahaha, sorry explanation was bad, that looks not like colliding but entering each other when target movement position for them all is the same
      NavMesh.avoidancePredictionTime = avoidancePredictionTime; // make it lesser and bugfixed a little

  • @bokuwa_Tobi_0210
    @bokuwa_Tobi_0210 หลายเดือนก่อน +1

    Bro your AI tutorials are best but bro please stop doing this "You-Yes You" part it sounds too cringe I am literally having goosebumps right now out of this cringe .

  • @Norimtim
    @Norimtim 7 หลายเดือนก่อน +2

    I like your videos ,but please stop with this" I'm here to help you, yes you", I always hesitate to click on your vid because of this intro. It's so much cringe my brain stops working. Please 🙏🙏🙏

    • @LlamAcademy
      @LlamAcademy  7 หลายเดือนก่อน +1

      🤔 hmm that's my favorite part of every video

    • @stargazerch
      @stargazerch 2 หลายเดือนก่อน

      Lol

  • @kirosmatavastros
    @kirosmatavastros 2 ปีที่แล้ว

    In short - Unity NavMesh is shit. What's new?

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +3

      Sorry, that's not at all the takeaway from this video. Is there room for improvement? Sure. Is it terrible? Absolutely not.

  • @Shakor77
    @Shakor77 ปีที่แล้ว

    Nowhere in this video does it say how you tweak these things. Avoidance time etc need to be explained how it is set in Unity instead of just theoretical how it works.

    • @LlamAcademy
      @LlamAcademy  ปีที่แล้ว +1

      Hi 👋. Sorry you didn't find that to be clear. Since this is a little more advanced tutorial I assumed you already knew where the configurations were done. Here are the relevant documentation links, I will also update the description to include those:
      Most of the configurations are on the NavMeshAgent itself: docs.unity3d.com/Manual/class-NavMeshAgent.html
      The higher level configurations such as the pathfindingIterationsPerFrame can be set at the NavMesh class: docs.unity3d.com/ScriptReference/AI.NavMesh.html
      And towards the end when talking about the surface configurations, those are on the NavMeshSurface component: docs.unity3d.com/Packages/com.unity.ai.navigation@1.0/manual/NavMeshSurface.html