Character Movement in Unity 3D | New Input System + Root Motion Explained
Вставка
- Опубліковано 30 лип 2024
- Learn to move characters in Unity 3D with this beginner-friendly explanation of Unity's new input system and root motion!
With this deep dive tutorial, you will not only have a better understanding of root motion and Unity's new input system, but you will also have an animated character by the end of the video!
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
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
Download From Mixamo: 0:39
Unity Setup: 0:58
Character Setup: 1:20
Create Animator Controller: 1:55
Animations To Animator: 2:08
Animation Transition Setup: 2:30
ROOT MOTION EXPLAINED: 3:11
Modifying Root Motion: 3:32
Bake Into Pose Setting: 3:49
Based Upon Settings: 4:05
Fixing Our Animation Issue: 4:30
New Input System Package Install: 4:50
NEW INPUT SYSTEM EXPLAINED: 5:08
Interface Breakdown: 5:28
Creating Actions: 5:48
Action Properties Explained: 6:30
Disambiguation Explained: 6:57
Bindings Setup: 7:23
Controller Detection: 7:57
Gamepad Binding: 8:15
Stick Deadzone Processor: 8:28
Run Action: 8:41
Create Player Input Class: 9:00
LETS CODE: 9:22
Animator Variable Declaration: 9:32
Movement Logic: 10:00
NEW INPUT SYSTEM CODE: 10:15
Actions Maps & Actions: 11:00
Event Listeners Explained: 11:16
Callback Implementation: 11:50
Accessing Gamepad Data: 12:29
Enable & Disable Action Maps: 12:48
Storing Gamepad Data: 13:15
Moving Character Implementation: 14:00
Character Moving: 14:43
Rotating Character Implementation: 15:04
Final Product: 16:09
Next Video: 16:18
wow that was one of the best tutorials I've seen. you show us everything AND most importantly -explain why. Thank you very much
Brackeys is gone, but seems like we have a new one here that may be taking his crown :D
He has potential
I was thinking the same thing!!
Brackeys helped us in though time ......
He's not Scandinavian, no sale!😂
I like how you bring focus to the proper section of the UI by either zooming and blurring background or using the red arrows. Also nice to see a reminder of what was entered in the UI while going over the script.
This is one of the best tutorials on Input I've seen in a long time! Very understanding in explanations. I hope you do much more in the future.
Found this by chance but you explained this really well, making it far more understandable than others I have watched. Giving the info really is key for any viewers to learn so this was perfect. Good job, subbed for future stuff!
Timestamps AND actual explanations?
Thank god I found your channel
I've been waiting for this video for so long, thank you!
Been binging your vids all day to get a better understanding of movement controllers in unity, i love your vids man, thanks for being awesome!
Nicky my man, We love youuuuuuuuuu!! We're so greatful for all the work and effort. Please give up more! :D
Absolutely brilliant tutorial. Your combination of clear instructions and great video editing is the perfect combination.
So glad I took a chance watching this. It's criminal that you don't have a bigger following, this was a very well made instructional!
It’s here! Woohoo!!! Amazing stuff as always!
After a series of really great videos, I'm now watching every video you post... which I do with only about 20 creators out of the hundreds of great youtubers on my shortlists. Keep up the great work.
Thanks! Very good and digestive tutorial. Sometimes when I watch tutorials, it feels like I need some discipline to keep watching, but for this, time passed in an instant, it flew so well.
Everytime I looking for something he always does it thank you
Almost 2 years later I still come back to the root motion section. It's explained way better than in the docs.
You know it, bro! 🙏
dude your great .I watched your video when ever i have doubt in player animation, you really deserve a medal .Thank you once again
I'm glad you are back! Keep continue brother.
You are great! I've been looking for an explanation of the new input system for a long time and you explain things really well, in a clear and simple way! Thank you!
Thanks so much Laurent!
Dude your tutorials are a saving grace please continue the work you’re doing
Probably another really great tutorial I'll have to learn later today. Hope your Channel grows big, you put so much effort into it, and they come out as the best tutorials I've seen.
The best tutorial for learning animation character controlling.U are the best Sir!
you're a great teacher, love the simplicity, with details! subbed!
TNice tutorials is by far, the best tutorial I have found so far. I feel like I’ll be spending a lot of ti on your channel! Thanks man! Keep up the good
Really useful video, super easy to follow and everything was explained so well! Thanks
Thank you for well explained tutorials, you have helped me a lot keep going man, i just want to mention 7:23 guys make sure that you choose pass through ( Action Type ) otherwise the player will keep moving in the idle state i've discovered this problem after 9 hours of digging Lol small advice make sure you have a cup of coffee to avoid these types of mistake xD, Again Thank you so much !!
Thank you very much!
Damn, you saved me a lot of frustration!. Any reason why that happens?
Fantastic. Great job Nicky.
Excellent job Nicky! Keep it up!!
Great video, Nicky! Very professional
Amazing tutorial, keep it up the good work !
Nice, your animation tutorials are so useful
Awesome stuff my man :)
Clean and informative video, thank you+
You've done it again MR. Nicky
that the best nwq input system tutorial! big thanks!
You're tutorials are so awesum!!!
Thank you so much for creating this tutorial!
It's been a great help for transitioning to the new Input System from the old one!
Subscribed!
Thank you for watching Aspiring Hero Games! Good luck with your dev journey
@@iHeartGameDev excuse me I have some unity question. somebody can help me?I am Taiwanese so my English is not well.
Nicely done! I've been very eager for a new input system, the old one was so bad for local co-op games.
Great video!! Eager for the video on Animation Rigging package! 😄
I like to see how other use the new Input System, well done Nicky👍.
Loving your content ⭐⭐⭐⭐⭐
hes just like us he didnt know about this, but he learned it and shared it to us. Thanks a lot!
Man OG OG I been messing with that Unity input system and no one out here explaining the callback f(x) like you. I been watching all these weird writing event function stuff and it make no sense to me. Been just reference my control scheme states instead of that performed function...still work, now I can pull out them more complex parameters like duration of that button press...
Love your tutorials mane
This is an amazing video to learn the new input system.
TNice tutorials tutorial is so useful,I tried tons of other tutorials but tNice tutorials was the best one
was a life-saver. Thanks a lot.
Underrated tutorial... You deserve Million sub's.. Great vid
Awesome job to you Unicky (Bad pun😅)(Replying to your awesome job to us in the ending). Understood root motion and the new Input system. Excited for the next videos in the series.
Love this thank you man.
thank you man,you are a legend
Thank you so much for this informative series, I am terrible with code but am forcing myself to go through the steps and follow along, its really what drives the game so I have to learn some of it haha, for a good while I was fighting with the code and using copilot and chatgpt to figure out why my character kept moving despite letting go of the thumb stick and I figured out it was my controllers sensitivity, it would be above a certain threshold even if I thought it was centered, its not a really old controller but the inputs are apparently a little sensitive
thank you bro keep going up
At 13:58 you should add another handler:
input.CharacterControls.Movement.canceled += ctx => movementPressed = false;
If you don't do this then movement will not cancel if the user doesn't guide the stick back into the deadzone (they just release it so it snaps backs to centre). Will save someone 30 minutes trying to find where the bug is.
Had this issue, thought it was my controller failing.. ty!
This comment is Golden when using the keyboard.. I had to put it on everything, aim, shoot, jump I'm still figuring out how I can get what I need outta the input system but.. yeah I'm closer now.. thanks again..
very good and quality materials, thanks.
You explained it very well.
This was an amazing tutorial
fav and tysvm for this tutorial it was helpful❤️.
Thank you! Hope the newer content helps too!
This is THE BEST tutorial!!! on the new input system why doesn't it has more views!!?!?!!
Dude you're AMAZING! You explain as you show how/where to find it. You show where to find it again with arrows. I could go on lol, but thanks your tutorial are what is was looking for. Thank you!!!
Thanks so much Bugzzy! 😊 happy to hear that you like the videos!!
such a good explanation.
finally thx god i wait this for long time
help to get the basics and I'll jus move from there. Thank you!
Thank you
wow this is so well made, more please just found the channel
Thanks for watching JustBitsAndPieces! :D
Amazing ❤❤❤
Awesome video congratz
Quality content!
love this channel
Nice tutorial
Hey Nick! I've a doubt that I'm using a 2D freeform directional blend tree and a sprinting animation transitioned to it. But when I toggle sprint I sharply switches to it, is there any way to smoothen the transition between them, or when in blender tree (2D freeform) jogging to walking to idle animation. 🙏🙏🙏 Thanks in advance...
with it in a few weeks or months if I pour enough ti and effort into it. I'll be watcNice tutorialng many more of your videos for tips and inspiration.
lol 3:53 on pause helped me more than dozens of videos. thanks!
One more great tutorial! Are you planning to make series about IK you mentioned before?
hey! thanks for your tutorial! Really well understanding and explicitly. I want to make a few suggestions about the code.(might be wrong..)
1. Instead of using if statement in the Update loop, I think using CharacterControls.Movement.cancelled to "SetBool = false" is better for performance.
2. There is no need to decide whether movementPressed is true or false using currentMovement.x != 0 || currentMovement.y != 0, because when the "performed" callback is in response, the button is pressed certainly.
Hey Eterlan! If you find more efficient ways of doing things in the code and everything works, go for the refactor! Code is always open to being optimized and refactored for the better! Love to see it, honestly. Cheers 🍻 -Nicky
great tutorial
decided to try it out.
I found this video to be very complicated compared with how easy you make everything to understand in other videos. Good job anyway !
I don't know if someone already asked, but how do the values get reset after receiving the input? runPressed will always be true after the first input (Run.performed). Same for currentMovement values they will always be 1 as soon as you press they key. I had to use CharacterControls.Movement.canceled in order to stop the motion. Is that the way is supposed to be? My question is how do you recognize a key being held with the new input system when the values do not update every frame? Thanks for the tutorials
I think you are the best unity helper on all universe thanks to you for helping us so much
thanks Freddy!
The best!
This is godsend
soooo... how does this work with the previous animator tutorial where we used the velocity float to blend and play the animations for walk to run?
finding the new input system to be quite confusing
thank you so much
you're welcome GamerCat :)
Hi I want to know on 13:42, when your cursor is on ReadValueAsButton, there's API explanation appears. I want to know how do you do that in VSCode? I moved my cursor to that keyword, and hold Ctrl key, and there's only some syntax statements appear...
Great video! Tons of useful information 🙂
Great video! How would you recommend changing the charactermovement script to move the character based on the position of a cinemachine camera
Plus+Ultra informative! Love your videos man. I did learned quite a lot from it, as with all of your amazing series! I totally feel the negatives are from pure envy, possibly from other content producers wanting to make the stats to look bad most likely because they are afraid of your steady progress and impressive video quality/content. After all, not many can manage to pull out such a huge amount of high quality content in barely 15 minutes... I'm confident Unity Technologies will get to note your series and approach you. Your videos are simply the best organized, well presented, clear and informative Unity videos out there I've seen so far, period. Hope you're having a nice holiday and keep up the great work man! 🔥💪
is it possible to do a movement like a car, for example, press w, player goes from 0 to speed variable and if you release w go from speed varible to 0 ?(or for the controller stick slow movement = slow speed, full stick movement = full speed) but not via script
The issue would it be What version of Unity that can make icon of Input Actions in Assets of the Projects window, I tried many times that failed though I understand that I have installed the Input System Package in my Project settings, help please.
Amazing work as always Nicky! How would I get this to work with a blend tree with strafing? I understand from your previous tutorials there's quite a lot more to it haha! I'd really appreciate the help! From you or anyone in this nice community!
very nice TUT .
the new input system is a bit overwhelming for me :/
I need to practice a bit .
subscribed + liked + shared the video
thanks a lot
You have no idea how grateful I am for tNice tutorials series
Nicky B, can't wait for the rigidbody video :) my character is slowly sinking into the ground and maybe that video will help my guy get out of quicksand
edit: seemed to have fixed it by baking the Y position into the pose
So, at 8:05 where you clicked the controller, when I did that, nothing happens, I had to right-click the controller and choose 'Open Device Debug View', only then did I see the activity you show in your video when clicking various controls on the controller. Thought this might help others.
Great video! Is it possible to modify the button mapping in code with the new Input system?
I hope you talk about the famous dilemma "character controller vs rigidbody" in your next video. I have read a lot about it but I still dont know which one should I use.
well if release the button the character stops suddenly, which doesn't seem nice, do you have any idea, how we could smoothly ease in and out between the run, walk and idle.
Can you explain me how we can block that the character pass through the walls when using an animation with root motion ? :(
Maybe I missed something, I have gone through the video a couple times, but for some reason the isWalking bool is not triggered when I release the stick. Any idea how to fix?
cool thanks
Hi ! Very informative video! However my question is if it is possible that when the player turns, that the joystick having a different position does not make the player return in the position of the joystick but based on the current one. What is not the case in the video...