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: • Sync Animator and NavM... ), 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.
Gargoyle Model used here: assetstore.unity.com/packages...
It's not required to run the project, but you will need to use a different model for the Player with 1D animation, or update the "PlayerMovement.cs" to set 2D Animator parameters like it's done in "EnemyMovement.cs".
👨💻 As always, all code from this video is available on GitHub: github.com/llamacademy/ai-ser...
💸 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...
📚 Resources 📚
⚫ Root Motion: docs.unity3d.com/Manual/RootM...
⚫ Synchronizing NavMeshAgents and Root Motion: docs.unity3d.com/Manual/nav-C...
⚫ NavMeshAgents and Other Systems: docs.unity3d.com/Manual/nav-M...
⚫ AI Series Part 3 - • Sync Animator and NavM...
As usual with the AI Series, we're using the NavMesh Components: docs.unity3d.com/Manual/NavMe... not the built-in navigation system.
❤ Believe in LlamAcademy's mission and have received value from the videos? Become a Patreon Supporter or KZitem Member:
⚫ Patreon: / llamacademy
⚫ KZitem Member: / @llamacademy or click the Join button on any video
📱 Let's stay connected
KZitem: / llamacademy
Patreon: / llamacademy
Facebook: / llamacademyofficial
Twitter: / thellamacademy
TikTok: / llamacademy
Instagram: / llamacademy
----
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: 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
Chapters:
00:00 Topic Introduction
01:22 3 Keys to Successful Root Motion Animated NavMeshAgents
03:42 Animator Overview - 2D Movement Blend Tree
04:52 Animator Overview - 1D Movement Blend Tree
05:54 NavMeshAgent Configuration
06:58 Why You May Want to Use Root Motion Animation
07:40 PlayerMovement.cs - Prepare Agent and Animator for Root Motion
08:46 PlayerMovement.cs - Synchronize Animator and Agent
09:42 PlayerMovement.cs - Set Animator Parameters
12:26 PlayerMovement.cs - Reconcile Difference in Animation and Agent Positions
13:24 Become a Supporter!
13:56 Demo & Showing Polish Focus Areas
15:21 Final Thoughts
Негізгі бет Root Motion NavMeshAgent Animation | AI Series Part 42 | Unity Tutorial
Пікірлер: 78