Using Root Motion with a Character Controller (Unity Tutorial)

preview_player
Показать описание
In this Unity game development tutorial we're going to look at how we can combine a Character Controller with Root Motion, to make the movement perfectly match the animation.

We'll start with an existing scene that has an animated character whose movement is controlled by a script.

We'll then convert this scene to use Root Motion to move the character, making use of the OnAnimatorMove method to utilise the movement of the animation when moving the Character Controller.

The project files are available to our patrons here:

Want to follow along? This project is a good starting point

The final script can be found here

Help support our work:

Follow us:

Introduction - 0:00
Converting the scene to use Root Motion - 0:50
Using Root Motion in combination with the Character Controller - 5:42
Solving sliding foot issue - 8:54
Summary - 11:45

#KetraGames #LearnUnity #UnityTutorials #UnityTips
Рекомендации по теме
Комментарии
Автор

The biggest thing I struggle with is making a character controller which is wild considering how common it is in any game. After so many tutorials and other videos, this is the only one to get it right! Thank you so much for your videos!

normanjebaits
Автор

I saw lot of videos about 3d animaotion but your videos have lot of details and its very useful. Thanks for the videos.

dogo
Автор

Thank you so much for making these videos, I wanted to use the Mixamo animations in my project and was really struggling to understand the animations and what settings needed to be adjusted. You are a lifesaver!

CodemanDTG
Автор

Hi Ketra, another excellent and helpful tutorial!!! The "OnAnimatorMove" explanation is what I was missing. Thanks for showing how it works to bridge the motion.

ricardolicorish
Автор

All of the videos on this channel are extremely high quality videos. I am new in the games industry. Just been working around 3 years and I am amazed at the depth all the contents of this channel goes into. A big thank you for all the effort.

muinchishty
Автор

wow, I just spent many hours googling, searching the forums and other tutorials for just this. Thank you, this was very clear and concise and helped me solve exactly the problem i had. Thats an ez subscribe and kofi from me. Cheers

thomasshaw
Автор

I like this video a lot because it shows a variety of real world situations and how to address them correctly. Thank you.

ChristianSasso
Автор

Wow! This is very complex, and essential tutorial! I need to learn this.

halivudestevez
Автор

Thank you a lot you saved me a huge effort. My animation were resetting position after being played and this tutorial was the key

barax
Автор

I was having a problem while making a third person game, and I was able to fix it thanks to you. Thank you so much.

fhdnjlm
Автор

It's really helpful! Thanks a lot

qlxjtjo
Автор

Thanks for the info! OnAnimatorMove is the link I was missing between using CharacterController and root motion.

WatThaDeuce
Автор

Probably the best tuts I've come across on Unity and Rootmotion - I recommend making a Udemy course <3 <3 if you haven't already

mrearlragnar
Автор

Hello Ketra! Just discovered your channel! Pretty cool content! I have one curiosity, will you ever cover topic like animation in combat system in your videos?

vima
Автор

I've followed ALL your tutorials! I love them all and have gotten everything to work, so far. I have one issue now. Everything is animated correctly and working well, except after I did the blend tree with idle as default, when the player is on a slope (idle, walking, or running), one foot is buried slightly in the terrain and the other foot is exactly on it. Or, one foot is on it and the other is floating very slightly above it. You said in another comment it might have to do with gravity. My Player (project) settings show -9.81 for both player and cloth. Any thoughts? I am using Mixamo character AJ. Any ideas on how to keep both feet on the ground?! Thank you so much! :) *big fan*

Edit: I added player specific gravity multiplier (physics) as you suggested in some other comments. This helped the floaty jumps (my multiplier is set at 1.3), but his uphill side foot still squishes into the ground (as if it is mud) and his downhill side foot still lingers just above it. I messed with the capsule collider and skin size and all that, to no avail. I determined it's not his Y axis height, or his gravity, it's like his X/Z axis doesn't rotate with the terrain. I'm hoping it's simple like the setting for the Root Transform Position on the XZ axes...note this happens in idle, walk and run. When I set that position to center of mass he was waist high in ground. I also checked "foot IK" on all the animations hoping that would make a difference. It did not. Okay I've tried all I can think of!! Any thoughts/help/ideas would be greatly appreciated!!

CCLawhon
Автор

Awesome Tutorial on creating environment! Can you make a following video on adding buildings? Also, how do you use a character to test the gameplay?

terryperehinec
Автор

Nice tutorial. Can anyone suggest a way to rotate a character in place (not moving) using root motion and a navmeshagent. I've been struggling with this for days now and can't find any answers anywhere.

fookustudios
Автор

Thank you so much. Great video. I have a question. If I add Rigidbody to my character with "apply root motion", it starts to fly. I cannot solve this problem. What is the problem? I want my character fall down, so I add it rigidbody. But while using root motion, it moves upward.

yusufilme
Автор

This looks exactly what I've been looking to learn. Any chance we can get a revision using the New Input System?

Hombredelverde
Автор

There is an issue at 0:35 in the "Sliding Down Slopes" tutorial, which I think has to do with root motion: The character runs against the steep slope and is blocked from running up, BUT the "run" animation keeps playing. Without root motion, the CharacterController would return velocity = 0 and the blend tree would go to "Idle". I'm pretty sure, you have a solution to this 🙂

lyrion