How to Move Characters in Unity 3D: Animated Movement Explained [Built-In Character Controller #2]
Вставка
- Опубліковано 10 лип 2024
- 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
iHeartGameDev Merch:
💛 www.iheartgamedev.com
WANT MORE?
Interested in learning more about animating characters in Unity? Check out my growing series of tutorials:
✅ • Unity's Animation System
✦ Like the vid? Please consider Subscribing!
bit.ly/2YdIb6j
✦ Missed out on the last episode?
• How to Move Characters...
SOCIAL:
✦ Discord
/ discord
✦ Twitter
/ iheartgamedev
LINKS FROM THE VIDEO:
🤖 Download Jammo for YOUR game:
assetstore.unity.com/packages...
⭐ And Check Out MixAndJam!
/ mixandjam
🌐 Learn about Quaternions
eater.net/quaternions
GEAR:
Lumix G7 Camera: amzn.to/3Kks1gZ
Epomaker GK68 Keyboard: amzn.to/3Ke87EB
Samson C01U Pro Mic: amzn.to/33kDdtG
LG 27" Monitor: amzn.to/3qAHFwS
Lepow 15.6" Portable Monitor: amzn.to/3287OtL
Logitech G604 Mouse: amzn.to/3A6jNV4
Audio-Technica ATH-M50X Headphones: amzn.to/3tBaeMT
X-Pen Artist 15.6 Pro Drawing Tablet: amzn.to/3FE5HLI
Apple 15in MacBook Pro Laptop: amzn.to/3AbKdFc
►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
Update Function & Time.deltaTime Explained: 16:39
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! ⭐
Get access and support the future of this channel here: www.patreon.com/iHeartGameDev
Thanks so much for watching and I hope this knowledge helps you on your gamedev journey!
Cheers! 🍻 -Nicky
Thx! But how to make it all look professional, smooth and beautiful? Do you have to go to study IK?
About 3rd character controller on web:
800 k where the player ll do dumb things, like walk AND run and... after that, game over...;
1.800.000 bilions where people try convincve "hey, this 2d is nice';
ZERO to: complete system with walk, run, JUMP (need some work, no? Gotcha)... crow... pick up a object - SIT ON CHAIR (minimal to start something descent)...and 100% of IDIOTS telling to us: buy plugins...
...fine... Unity is 'free'... the knollege... dont...pay for it... good job, mate...
@iHeartGameDev, do you happen to have a udemy course on 3rd person knockdown+getting back up?. I would love study on the basic for that. And I would pay for it too if its on udemy.
If anyone is having an issue where Visual Studio cannot find the CharacterControls - make sure you hit "Save Asset" in your PlayerInput window. Derp.
Man how do I do that there's not save button in the playerinput window please help
ty
@@bob69927 did u get that?plz help
@@hanjr5122 generate C# class in the inspector.
You are a life saveR!!!!!
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!
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!
Thank you so much for this video!
In a comprehensive and clear way, you explain things that are not always obvious, and show us almost ready-made modern optimal game functionality with a minimum of code!
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!
Such a wonderful explanation! A true delight to watch! 😍 Keep up the awesome informative videos and stay amazing, man! 🥳
Simply Awesome there are so many things I am understanding better with your Tutorial. I was coding without really understanding how it works. I simply knew this part does that. Please keep up the good Work I love your tutorials
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!
Thanks Eddy!
awesome content mann!!!! This is the only channel that I've found so far that explains EVERYTHING in depth! Keep em coming please :))
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.
Just found your channel and I am absolutely stunned!! Your content is so amazing and explained in such an amazing way!! Thank you so much for your hard work and being so informative!! You Rock
Your tutorials and lessons are amazing!
Easily the best content around unity I found on UA-cam since I started learning game dev
Thank you so much!!
Your tutorials are Realy great !
They seems complete, with all the good tips or last news, clear and nice to watch
Thank you! More coming soon!
Thankyou so so so much!!!! Can't tell you how important this channel has been in learning Unity as a self-taught dev!! Thanks a ton!! Looking forward to next videos...!!!!! :)
Phenomenally clear tutorial. So much nicer than the old system and it's all very intuitive. Thank you.
such high quality content. thank you for all of your work to make things clear
Your tutorials are amazing. Please keep making more
This is a really great, intuitive, and easy-to-understand lecture. Thank you for providing the video.
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. 👍
Valem!! Thanks so much mate! The feelings are completely mutual regarding your videos as well! Super inspirational to watch how far your channel has come since I first started watching 😄
BluXombie: I have been waiting all week for this. Thank you.
Let me first start off and say that I very very rarely leave comments, so the fact that I'm doing so holds extra weight from me. Your channel is the best Unity channel I've found. Your explanation is so clear and concise, yet thorough. You really strike the perfect balance. Things are clicking for me that haven't in other attempts to learn Unity. I hope you keep making videos because I'll sure as hell keep watching them.
Hey thanks so much Rich! Love to hear when things connect for people! More to come from from me in the future, for sure!
Cheers 🍻 -Nicky
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.
Thanks very much Peter!
Great tutorial series! Just wrapped it up.
I fixed it and thanks for such an easy to understand video for a movement control!
Another great video and editing! 🎉Congrats on the Patreon!
Thank you Sam!! :D Super excited to finally have that out there!
It was amazing following these tutorials.
Fantastic job! Great Tutorial! Appreciated the level of detail!
The best ever explanation of gameDev .. very helpful.
was looking for a way to handle input system in classes without having to assign any one of them and this is just casually dropped on me, wow.
respect
these videos are literally the best on movement in unity.
I am struggling in 3D animation, thanks to your videos of your channel have enlighted me so much! Thank you so much.
Amazing! Thank you for watching, Nguyen!! -Nicky
Я плохо знаю английский и редко смотрю видео на неём, но мне очень нравятся ваши лекции. Вы говорите чётко, лаконично, пишите понятный код и объясняете всё необходимое. Спасибо!
Thank you for your time one of the best tutorial on input system and built in controller
Hello! Great tutorial as always! I'm so thankfull for these amazing videos!
Since you have covered character control - animation so good, maybe consider creating "enemies" / NPCs with some kind of AI navigation / behavior and / or ragdoll activation!
Seriously with all this vast amount of information on the internet, complex topics like the ones you cover can be such a headache for someone like me who is trying to learn, and yet the way you explain things, set goals, have stuff in order....is seriously soothing and helps me and many peope a lot! THANK YOU! Keep up the amazing work!
Totally love the tutorial really helpful. Thank you🤩
Finally, i found a alternative for Brackeys channel.
Please keep going!
Thank you!
Up until the Code Part this is the very best, Clearest most concise Tutorial I have ever watched. It would be great if there was a Bolt or play Maker version for 3d character Animators. AWESOME!!!
Thank you very much, the rotation thing was turning me crazy!
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!!!
Glad it helped!
Explained very well and understandably. I learned a lot of new things
Your Tutorial Helps Me For My Project Thanks for Those Unity Tutorials Bro!!. Keep it Up bro!!
This is great! You have the technical explanations of Jason Weinmann with the accessibilty of Brackeys!!! I can use this to improve my Brackeys Third person controller projects!!
bruh this guy is underrated af really great tutorials man keep it up
Always awesome tutorials... Thanks for making
I never comment on UA-cam, but this tutorial was unreal, way to go! Subbed
Awesome, thank you! I really appreciate the kindness!
The best one i recently watched for input system..Please make some extra videos on same topic
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 (characterController.isGrounded) {
float groundedGravity = -.05f;
currentMovement.y = groundedGravity;
currentRunMovement.y = groundedGravity;
} else {
float gravity = -9.8f;
currentMovement.y += gravity;
currentRunMovement.y += gravity;
}
}
Yep! Totally meant for the code to have that there, but glad you caught it and figured it out! 🙌
Really cool lessons, thanks Nicky!
Wow, I was so lucky to find your tutorial is excellent. Very professional Thank you.
Thanks for watching!
YES!! So excited!!!
Thank you Salvador!!
I would love if you could do a video on the input system and combos. There are definitely some decisions to make as to whether you handle combo logic in the animator state system or in code only.
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
Love this video! Great detail and super clear. What about another video on how you could implement other movement like dashing, sliding, and jumping? Maybe even climbing? Loving the videos though!
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!
Seconded
I may become a developer because of you, thank you so much with the informative content.
You probably can read minds! This is what i was looking for! Thank you!
Rad! Thanks so much for watching! -Nicky
Dang, your tuts are fiya!
Excited already!
Thank you Mia!! Hope the video helps you on your gamedev journey!
Awesome Videos, You helped me in unity animation a lot
That's awesome! Thanks for watching!!
Wow... this is like a culmination of all your lessons until now
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!
OH MY GOD THANK YOU! I could NOT figure out why that part wasn't working. You're a life savor.
I know I'm two years late but dude seriously, thanks a ton for pointing that out, I got stuck on that part too
not sure if it's mentioned elsewhere, I had to change to currentRunMovement.y += gravity; as well 👍
Fantastic tutorial, really great...
Great video, as always!
Thanks Alex!! Hopefully you learned something new from the video or it clarified some things! Always happy to see you in the comments and appreciate you in the Discord server!
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 :)
Thanks so much for watching Alvin!
great stuff, best i have found for free!!
thank you very much for this video !! You explain very weel .
Dude, I figured this one out, but now #3 has got me stumped.
this video very helpful to me, thank you so much!
Happy it helped!!
I really really love your videos!
Thank you so much!
I've watched most of your videos and this is IMO by far your best video yet! Could you use the Mixamo turn left and turn right animations to make turns smoother?
super cool!!
Amazing video Nicky!
Thank you Sig!! Always appreciate the constant support!
@@iHeartGameDev Ofcourse! Keep up the good work!
not only your talented your a genius , today I was so amazed and at the same time I'm learning your teaching from hashing, floating gravity written in C# I never have education as you , but today I feel excited to learn that Unity Program ,lucky those students who study comsci ,I never been previllige to have a diploma thanks to yt it gives a broad training ground for all learner just like me btw i'm 50 yrs old still interested this things in digital world. I wish many young Game dev Learn from you I know they're. thankyou for sharing your knowledge if i die at least i know how does this work ! next time I'm excited to see how the gizmo hold weapon and slash.🤖👾stay awesome your excellent teacher in this yt community.👈
You are making one of the best learning content. Thanks. Could you please also help how to add a TP camera and turn by the camera movement?
Great job man!
Thank you so much!
Great content!
This channel is about to become the next big thing in Unity
Thank you :D
Subbed. Thanks for the info!
Thank you for watching and subscribing!
you saved my day
This ia a great video with all the coding and stuff.. I'm not that good at coding.. But the end result of this video is motivation to get better. Cant wait to get a character to walk and run in unity🙃
Thanks as always for stopping by the video, Odinnie! I hope it helps you on your gamedev journey!
Pls Explain shaders in unity. I love your teaching style. I learnt about animations from your videos. Keep it up
For anyone getting a PlayerInput / CharacterControls error around 13:30, make sure you don't have any other existing playerInput.cs from past tutorials in your project. I've been reusing the same project and just making new scenes for each tutorial, archiving all of the crud from the earlier tutorials fixed things.
awesome!!!!😃
Great tutorial, i recomment to toggle the run button
Thank u man
Thank you
Your videos have been a huge help to us. Can you do one video tutorial on Skinned Mesh Renderer.
Keep sharing. Thanks.
Muchas gracias !!!
you are the best!
Just a quick tip: While adding a new script through the Inspector window (as a component), you don't have to type 'script' and then type the name of the script. You can just type the name of the script and it will automatically create a script with that name. (11:23)
great tutorial series so far, personally I think it would have been better to fully cover all the coding aspects of movement systems before moving to animations but all good
thank you
Great series on the character controller and new Input System. How would one go about changing the Input so Forward on the Joystick and Keyboard is always in the direction the character is facing. So for instance if the character turned left - then left would actually become forward?
thanks
In the Player Input section in Unity, don't forget to check the Auto Save. If you forgot to save after changes, the scripts for input is not going to work.
Thanks for an awesome super useful tutorial. I think some stuff was not said in the video but shown in code in the video itself so it took a bit extra time sometime to discover what I was missing but i learnt a lot from your video and im looking into continue on your tutorial videos.
Have an amazing day and I look forward to learn more
You da man nick!
Thank you for the kindness!
It would be great if at the end of the video you can show how the whole finished code looks like. Since I am brand new to c# coding it be a great help to show what my finished code should look like. And give you chance to correct any typing errors you may have typed while doing the video.
Great video
can you cover foot placement using Animation Rigging