How to Move Characters in Unity 3D: Animated Movement Explained [Built-In Character Controller #2]

preview_player
Показать описание
A breakdown and explanation of how to properly move animated characters in Unity 3D! Learn movement with the Built-In Character Controller and New Input System!

This beginner-friendly tutorial is a COMPLETE walkthrough of how to use Unity 3D's built-in character controller to get a character moving while incorporating animations! In addition, we take the time to break down complicated concepts and understand how it all works!

Small update in 2022: Thanks to Cláudio Costa for pointing out a change in more recent versions of Unity: the "2D Vector Composite Binding" has been renamed to "Up/Down/Left/Right Binding". It is still functionally the exact same though! ✨

ACCESS PROJECT FILES & SUPPORT THE CHANNEL:
iHeartGameDev Merch:

WANT MORE?
Interested in learning more about animating characters in Unity? Check out my growing series of tutorials:
✦ Like the vid? Please consider Subscribing!
✦ Missed out on the last episode?

SOCIAL:
✦ Discord
✦ Twitter

LINKS FROM THE VIDEO:
🤖 Download Jammo for YOUR game:
⭐ And Check Out MixAndJam!
🌐 Learn about Quaternions

GEAR:

►TIMESTAMPS:
Intro: 0:00
Walkthrough Breakdown: 0:40
Download Project Animations: 1:00
Fresh Unity Project: 1:22
Import & Modify Animations: 1:50
Jammo Setup: 3:10
Adding Animator Component & Animation Controller: 3:42
Animation States Setup: 4:22
Animation State Transitions: 4:59
Adding Animations To Animation States: 5:40
New Input System Setup: 6:10
What are Input Actions: 6:24
Action Maps, Actions & Properties: 6:38
Our First Action Map & Action: 7:01
Setting up the Move Action: 7:22
Input Bindings Explained: 8:22
2D Vector Composite Explained: 9:36
Setting up the Run Action: 10:00
IMPORTANT Generate Input Class: 10:25
Are You New to Coding: 10:58
Add a Script to Jammo: 11:17
Accessing our PlayerInput Class: 11:37
Callback Functions Setup & Explained: 12:24
Testing Callback Function: 13:14
Enable & Disable Action Maps: 13:44
Storing & Using the Input Data: 14:23
Adding & Accessing the Character Controller: 15:31
First Movement Code: 16:24
Setting Up More Input Callbacks: 17:29
Don't Repeat Yourself Movement Refactor: 18:10
Access Animation through Code: 18:55
HandleAnimation Function Setup: 19:30
Learning to Turn with Quaternions: 20:50
HandleRotation Function Setup: 21:20
Quaternion Slerp Explained: 22:27
Run Movement Setup & Code: 23:18
Animator Parameter Hashing Refactor: 25:05
Running Animation Code: 25:31
HandleGravity Function Setup: 26:10
Final Result: 26:56
How to Vote on the Next Tutorial: 27:13
Рекомендации по теме
Комментарии
Автор

⭐ I'm SUPER excited to share that this project file is available on the brand new iHeartGameDev Patreon! ⭐

Thanks so much for watching and I hope this knowledge helps you on your gamedev journey!
Cheers! 🍻 -Nicky

iHeartGameDev
Автор

Man, I hardly ever comment anything on a tutorial video. And I have to say I have tried tons by now. This one completely exceeded my expectations. Love it and I will be coming back Sir!

michgrizz
Автор

If anyone is having an issue where Visual Studio cannot find the CharacterControls - make sure you hit "Save Asset" in your PlayerInput window. Derp.

Katubug
Автор

Your tutorials are consistantly the best I can find on a given topic, I've been struggling to learn the new input system for a few months and you've distilled it brilliantly - keep it up!

sinananan
Автор

Amazing tutorial Nicky I love your energy ! The amount of work you put in the editing to help us better understand each concept is crazy thank you so much. 👍

ValemVR
Автор

Hey man, great video! You have a real talent for delivering very complex tutorials in a very welcoming way.
I did just want to report an issue I ran into right near the end. While writing the gravity in you never mention in the video that you add handGravity to the void Update. It just gets added between takes.
This is a very obvious step, but as a total newcomer I was stuck here for a while. At least I learned a lot while trying to hunt down the answer!

kiddynamo
Автор

I had to add a y to the last currentRunMovement line in the handleGravity function and also call that in the update function for things to work. Having to figure this out made me feel smart af.

void handleGravity()
{
if {
float groundedGravity = -.05f;
currentMovement.y = groundedGravity;
currentRunMovement.y = groundedGravity;
} else {
float gravity = -9.8f;
currentMovement.y += gravity;
currentRunMovement.y += gravity;
}
}

dylankingarchive
Автор

I just found your channel, this is the most clean way I have ever seen anyone explain animation, thank you !!!! you have a follower for life!

eddyrc
Автор

Recently came across your channel. I’ve got to say, this is some of the best content I’ve seen since Brackeys. You are clear, concise, and do an excellent job referencing components. Keep up the great work Nicky!

thesamdogg
Автор

Nicky, the quality of your content is off the scale! Outstanding work, well done. I espeically liked the way you popped up a view of something you had previously configured in a little side-window to help remind us how they were associated to what you were doing in the code.

TheJazzygeoff
Автор

This is probably the only channel that has taught me about unity’s animation system, Great tutorial ! I’ll be waiting for the rigid body controller next :)

AllHailLordMegatron
Автор

This is a fantastic tutorial, you go over everything in just enough depth to understand what you are doing, but not so much so that it goes over a beginners head!

derekablackburn
Автор

I was stuck in all kinds of new input system tutorial and right about to explode, but thanks for uploading this clear demonstration! You are my lifesaver!!!

hummingBirdArtstudio
Автор

This is perfect! It answers a lot of questions I had about movement, animation, and the input system. If you made a tutorial on how to do combos in melee combat I would be completely set! Thank you do much for making this!

ytwithlove
Автор

This is such a great guide!
Especially if you watched the entire series "Let's Learn Unity!" up to this point.

-> It sums up the previous learned things and combines them.

Thank you so much for sharing this knowledge with us, even as not native speakers you are perfectly understandable and (with some pauses) easy to follow.

peterschrader
Автор

Just started my main project yesterday as a beginner but have decided to take the time to run through your tutorials, your breakdowns and resource links in combination with Unity are above and beyond whats needed and I'm sure every who watches your channel massively appreciates this, thanks so much for these videos <3

mattnash
Автор

Я плохо знаю английский и редко смотрю видео на неём, но мне очень нравятся ваши лекции. Вы говорите чётко, лаконично, пишите понятный код и объясняете всё необходимое. Спасибо!

asver
Автор

Got Stuck anyone know what his means and how to fix it?

Assets\AnimationAndMovementController.cs(51, 21): error CS1061: 'PlayerInput' does not contain a definition for 'CharacterControls' and no accessible extension method 'CharacterControls' accepting a first argument of type 'PlayerInput' could be found (are you missing a using directive or an assembly reference?)

MATTERSGAMES
Автор

I am struggling in 3D animation, thanks to your videos of your channel have enlighted me so much! Thank you so much.

nguyenhuuphu
Автор

This is a really great, intuitive, and easy-to-understand lecture. Thank you for providing the video.

sss-nkhv