Animate Your NavMeshAgents with Root Motion | AI Series Part 42 #Shorts




Published: 29 Sep 2022

Full Tutorial: https://youtu.be/uAGjKxH4sDQ


Learn how to combine a Root Motion animated model with a NavMeshAgent! This gives you all the pathing benefits and local avoidance of the Navigation System with the precise animation you expect from Root Motion.


Root Motion is a great way to remove that annoying "foot sliding" from mismatched animation vs velocity. But synchronizing that motion with a NavMeshAgent can be tricky! The NavMeshAgent knows where to go and considers local avoidance. So, there's a lot of things to consider when trying to match these two systems!


We've already learned how to animate NavMeshAgents where the NavMeshAgent drives the Animator state (way back in AI Series Part 3: https://youtu.be/wLZPM46zgUo), but in this video we're going to do it the other way - with the Animator driving the NavMeshAgent!


There are multiple ways to approach this solution. In this repository I have chosen what makes the most sense to me - correcting the position of the Root Motion to pathable areas by moving the position of the model back towards the NavMeshAgent when they are out of sync.


As always, all code from this video is available on GitHub: https://github.com/llamacademy/ai-series-part-42


Gargoyle Model used here: https://assetstore.unity.com/packages/3d/characters/creatures/gargoyles-fantasy-rpg-37416?aid=1101l9QvC


📚 Resources 📚

⚫ Root Motion: https://docs.unity3d.com/Manual/RootMotion.html

⚫ Synchronizing NavMeshAgents and Root Motion: https://docs.unity3d.com/Manual/nav-CouplingAnimationAndNavigation.html

⚫ NavMeshAgents and Other Systems: https://docs.unity3d.com/Manual/nav-MixingComponents.html


As usual with the AI Series, we're using the NavMesh Components: https://docs.unity3d.com/Manual/NavMesh-BuildingComponents.html not the built-in navigation system.


📱 Let's stay connected

YouTube: https://youtube.com/c/LlamAcademy

Patreon: https://www.patreon.com/llamacademy

Facebook: https://facebook.com/LlamAcademyOfficial

Twitter: https://twitter.com/TheLlamAcademy

TikTok: https://tiktok.com/@LlamAcademy

Instagram: https://instagram.com/LlamAcademy


----


Believe in LlamAcademy's mission and have received value from the videos? Consider becoming a Patreon supporter: https://www.patreon.com/llamacademy


----

Most tutorials come from knowledge gained making https://survival.llama.software Llama Survival - a top-down zombie survival shooter for Android and iOS.

I also have some Unity Assets: https://assetstore.unity.com/publishers/22409?_aid=1101l9QvC

Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.


Connect on Social Media

Some links may be affiliate links, which at no additional cost to you, gives LlamAcademy a small portion of the purchase.