Character Movement in Unity 3D | New Input System + Root Motion Explained

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ธ.ค. 2024

ความคิดเห็น • 351

  • @AetherXIV
    @AetherXIV 4 ปีที่แล้ว +83

    wow that was one of the best tutorials I've seen. you show us everything AND most importantly -explain why. Thank you very much

  • @Hakohn2511
    @Hakohn2511 3 ปีที่แล้ว +74

    Brackeys is gone, but seems like we have a new one here that may be taking his crown :D

    • @remcrap1139
      @remcrap1139 3 ปีที่แล้ว

      He has potential

    • @devinmcgee5265
      @devinmcgee5265 3 ปีที่แล้ว

      I was thinking the same thing!!

    • @lqd8367
      @lqd8367 3 ปีที่แล้ว +1

      Brackeys helped us in though time ......

    • @Ihasfinger911
      @Ihasfinger911 2 ปีที่แล้ว

      He's not Scandinavian, no sale!😂

  • @mikedavies4237
    @mikedavies4237 ปีที่แล้ว +16

    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.

    • @drmeatball124
      @drmeatball124 9 หลายเดือนก่อน +1

      Had this issue, thought it was my controller failing.. ty!

    • @Hoptronics
      @Hoptronics 7 หลายเดือนก่อน

      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..

    • @mohmmadatalla4664
      @mohmmadatalla4664 3 หลายเดือนก่อน

    • @judzam14
      @judzam14 2 หลายเดือนก่อน

      @@mohmmadatalla4664 Dude you saved me, the input was setting the bool to true and this was the only way I found to set it to false, luv ya appreciate ya

    • @andreyradostny
      @andreyradostny 2 หลายเดือนก่อน

      Thank you so much for saving my 30 minutes! 🤝

  • @StevenBloomfield
    @StevenBloomfield 4 ปีที่แล้ว +26

    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.

  • @AlexBlackfrost
    @AlexBlackfrost 2 ปีที่แล้ว +6

    Almost 2 years later I still come back to the root motion section. It's explained way better than in the docs.

  • @colorzFX
    @colorzFX 3 ปีที่แล้ว +20

    Timestamps AND actual explanations?
    Thank god I found your channel

  • @sam-2796
    @sam-2796 2 ปีที่แล้ว +15

    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 !!

    • @blackulrich
      @blackulrich 2 ปีที่แล้ว

      Thank you very much!

    • @juansotomayor9076
      @juansotomayor9076 9 หลายเดือนก่อน

      Damn, you saved me a lot of frustration!. Any reason why that happens?

  • @Khomeini_N.S.E
    @Khomeini_N.S.E 4 ปีที่แล้ว +6

    You've done it again MR. Nicky

  • @aniketsinghrawat7887
    @aniketsinghrawat7887 2 หลายเดือนก่อน

    I have been trying to do some animations on a basic character for a week now. Finally, everything was resolved by this video. Thanks for the help

  • @RussmanDesignHD
    @RussmanDesignHD 3 ปีที่แล้ว +15

    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.

  • @galogalliani1746
    @galogalliani1746 2 ปีที่แล้ว +1

    TNice tutorials tutorial is so useful,I tried tons of other tutorials but tNice tutorials was the best one

  • @charuzu1397
    @charuzu1397 2 ปีที่แล้ว +1

    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!

  • @ninjaser6449
    @ninjaser6449 4 ปีที่แล้ว +4

    Everytime I looking for something he always does it thank you

  • @sonisinha8912
    @sonisinha8912 3 ปีที่แล้ว +3

    The best tutorial for learning animation character controlling.U are the best Sir!

  • @Cerealfrog
    @Cerealfrog 3 ปีที่แล้ว +1

    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!

  • @CymbalMonkey
    @CymbalMonkey 3 ปีที่แล้ว +4

    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!

  • @blend-eren9526
    @blend-eren9526 4 ปีที่แล้ว +4

    I've been waiting for this video for so long, thank you!

  • @Chickengbs
    @Chickengbs 4 ปีที่แล้ว +4

    Nicky my man, We love youuuuuuuuuu!! We're so greatful for all the work and effort. Please give up more! :D

  • @ddinoboy
    @ddinoboy ปีที่แล้ว

    lol 3:53 on pause helped me more than dozens of videos. thanks!

  • @tayyabchadhar3876
    @tayyabchadhar3876 4 หลายเดือนก่อน

    man I still love your work and the dedication you put into it. it is just amazing. Thanks for sharing.

  • @toyfox4228
    @toyfox4228 2 ปีที่แล้ว

    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

  • @eterlan2538
    @eterlan2538 3 ปีที่แล้ว +15

    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.

    • @iHeartGameDev
      @iHeartGameDev  3 ปีที่แล้ว +10

      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

  • @abhinavsatheesh9640
    @abhinavsatheesh9640 3 ปีที่แล้ว

    dude your great .I watched your video when ever i have doubt in player animation, you really deserve a medal .Thank you once again

  • @ajmckennan1663
    @ajmckennan1663 4 ปีที่แล้ว +2

    It’s here! Woohoo!!! Amazing stuff as always!

  • @denizhacoglu1680
    @denizhacoglu1680 4 ปีที่แล้ว +2

    I'm glad you are back! Keep continue brother.

  • @qwerty6vov
    @qwerty6vov 3 ปีที่แล้ว +1

    that the best nwq input system tutorial! big thanks!

  • @OFCIFR
    @OFCIFR ปีที่แล้ว

    I found this video to be very complicated compared with how easy you make everything to understand in other videos. Good job anyway !

  • @TrippyGamer
    @TrippyGamer 3 ปีที่แล้ว

    This is THE BEST tutorial!!! on the new input system why doesn't it has more views!!?!?!!

  • @dreamisover9813
    @dreamisover9813 4 ปีที่แล้ว

    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.

  • @hackerasaweshacreasedd
    @hackerasaweshacreasedd 2 ปีที่แล้ว

    You have no idea how grateful I am for tNice tutorials series

  • @phantomdragonstudio252
    @phantomdragonstudio252 2 ปีที่แล้ว

    Most Underrated channel in game dev.

  • @ambiguouscompany
    @ambiguouscompany 2 ปีที่แล้ว

    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

  • @m0ch1_6
    @m0ch1_6 3 ปีที่แล้ว +1

    Underrated tutorial... You deserve Million sub's.. Great vid

  • @blabli9978
    @blabli9978 4 ปีที่แล้ว +1

    hes just like us he didnt know about this, but he learned it and shared it to us. Thanks a lot!

  • @Tiger66261
    @Tiger66261 3 ปีที่แล้ว +1

    Absolutely brilliant tutorial. Your combination of clear instructions and great video editing is the perfect combination.

  • @freddycortina
    @freddycortina 2 ปีที่แล้ว +1

    I think you are the best unity helper on all universe thanks to you for helping us so much

  • @aarondavidlewis
    @aarondavidlewis 4 ปีที่แล้ว

    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.

  • @synapticstudios6388
    @synapticstudios6388 4 ปีที่แล้ว +1

    Fantastic. Great job Nicky.

  • @heyitsnev
    @heyitsnev 3 ปีที่แล้ว +1

    in unity i get an error that states (Parameter 'Hash 20590411' does not exist) how do you fix that?

  • @IamMegaJustMega
    @IamMegaJustMega ปีที่แล้ว

    This is an amazing video to learn the new input system.

  • @GilbertLovesCats
    @GilbertLovesCats 4 ปีที่แล้ว +4

    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.

  • @Jet_Mishemoto
    @Jet_Mishemoto 3 ปีที่แล้ว

    Dude your tutorials are a saving grace please continue the work you’re doing

  • @JustBitsAndPieces
    @JustBitsAndPieces 3 ปีที่แล้ว +1

    wow this is so well made, more please just found the channel

    • @iHeartGameDev
      @iHeartGameDev  3 ปีที่แล้ว

      Thanks for watching JustBitsAndPieces! :D

  • @ignacio3602
    @ignacio3602 2 ปีที่แล้ว

    you're a great teacher, love the simplicity, with details! subbed!

  • @LaurentBRISSON
    @LaurentBRISSON 3 ปีที่แล้ว

    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!

  • @itadori6807
    @itadori6807 2 ปีที่แล้ว +1

    fav and tysvm for this tutorial it was helpful❤️.

    • @iHeartGameDev
      @iHeartGameDev  2 ปีที่แล้ว

      Thank you! Hope the newer content helps too!

  • @signalised9540
    @signalised9540 4 ปีที่แล้ว +1

    Clean and informative video, thank you+

  • @agarwalpublicintercollege7890
    @agarwalpublicintercollege7890 2 ปีที่แล้ว

    help to get the basics and I'll jus move from there. Thank you!

  • @alexjackson3767
    @alexjackson3767 4 ปีที่แล้ว +1

    Awesome stuff my man :)

  • @TheAguilacelestial
    @TheAguilacelestial 4 ปีที่แล้ว

    Excellent job Nicky! Keep it up!!

  • @AspiringHeroGames
    @AspiringHeroGames 3 ปีที่แล้ว +1

    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!

    • @iHeartGameDev
      @iHeartGameDev  3 ปีที่แล้ว +1

      Thank you for watching Aspiring Hero Games! Good luck with your dev journey

    • @yokj9081
      @yokj9081 3 ปีที่แล้ว

      @@iHeartGameDev excuse me I have some unity question. somebody can help me?I am Taiwanese so my English is not well.

  • @akashjaiswar9437
    @akashjaiswar9437 4 ปีที่แล้ว +1

    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.

  • @missmealey
    @missmealey 3 ปีที่แล้ว

    Really useful video, super easy to follow and everything was explained so well! Thanks

  • @punjabigamers751
    @punjabigamers751 4 ปีที่แล้ว +2

    Can you do a cinemachine tutorial ?

  • @cookiewood6727
    @cookiewood6727 3 ปีที่แล้ว

    Amazing tutorial, keep it up the good work !

  • @moniques1377
    @moniques1377 2 ปีที่แล้ว +1

    Loving your content ⭐⭐⭐⭐⭐

  • @chupitheslug
    @chupitheslug 3 ปีที่แล้ว

    You're tutorials are so awesum!!!

  • @wesley6442
    @wesley6442 11 หลายเดือนก่อน

    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

  • @icarosh1
    @icarosh1 3 ปีที่แล้ว +2

    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

  • @richardrothkugel8131
    @richardrothkugel8131 3 ปีที่แล้ว +1

    For anybody who couldn't access the CharacterControls from the input. You need to place the PlayerInput script in the same location as the script trying to access it.

    • @janpatrickconde4933
      @janpatrickconde4933 3 ปีที่แล้ว

      What do you mean in the same place?

    • @richardrothkugel8131
      @richardrothkugel8131 3 ปีที่แล้ว

      @@janpatrickconde4933 scripts need to be in the same physical folder

    • @janpatrickconde4933
      @janpatrickconde4933 3 ปีที่แล้ว

      @@richardrothkugel8131 Oh ok, I understand now. Thank you!

  • @samisalama3033
    @samisalama3033 ปีที่แล้ว

    is there a tutorial for keyboard movement?

  • @mboe94
    @mboe94 3 ปีที่แล้ว +2

    Thanks for a great video. However, if I wanted to use keyboard and mouse with that setup, how would the script be different? (and input)

  • @Bugzzyy
    @Bugzzyy 3 ปีที่แล้ว

    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!!!

    • @iHeartGameDev
      @iHeartGameDev  3 ปีที่แล้ว

      Thanks so much Bugzzy! 😊 happy to hear that you like the videos!!

  • @mominafaraz9924
    @mominafaraz9924 2 ปีที่แล้ว

    was a life-saver. Thanks a lot.

  • @tauheedgamedev2388
    @tauheedgamedev2388 4 ปีที่แล้ว

    Nice, your animation tutorials are so useful

  • @zaurkurbanismailov9104
    @zaurkurbanismailov9104 2 ปีที่แล้ว +1

    The best!

  • @Oleg_UE5
    @Oleg_UE5 2 ปีที่แล้ว

    One more great tutorial! Are you planning to make series about IK you mentioned before?

  • @donatoavena402
    @donatoavena402 2 ปีที่แล้ว

    Yes it can - don't despair!

  • @JamesLee-lf4fr
    @JamesLee-lf4fr 3 ปีที่แล้ว

    very good and quality materials, thanks.

  • @macleodgordon
    @macleodgordon 3 ปีที่แล้ว +1

    So I did this 5 times now and my character did not move from Idle. Then I checked 'on' the 2 Boolean parameters you created at 2:29, and it worked (albeit, he only walks, doesn't run), yet your character moved, walks, then runs, then walks, then runs.... How is that possible?

  • @blackspear7257
    @blackspear7257 4 ปีที่แล้ว

    Great video!! Eager for the video on Animation Rigging package! 😄

  • @bbtoon
    @bbtoon 2 ปีที่แล้ว

    thank you man,you are a legend

  • @Billsberry504
    @Billsberry504 3 ปีที่แล้ว +1

    What Plugins you got for vs code Im not getting something here.

    • @iHeartGameDev
      @iHeartGameDev  3 ปีที่แล้ว

      There’s a full setup process for VSCode! I think there are some video tutorials that will help! Check out SamYam!

  • @endlesssuction8288
    @endlesssuction8288 4 ปีที่แล้ว +1

    Nicky hello, could you please do IK tutorial from scratch?

  • @Radek_M.
    @Radek_M. ปีที่แล้ว

    The issues:
    14:44 when you tap the joystick player X position value is increasing (player is turning right)
    16:09 again when you tap the yoystick X is increasing and also Y is decreasing (player is turning right and goes slowly under the plane).
    How to fix this?

  • @ammoniti0n
    @ammoniti0n ปีที่แล้ว

    How about for Keyboard inputs?

  • @watercat1248
    @watercat1248 3 ปีที่แล้ว

    2:30 this the part i wash looking for but how im able to do smarting like this on the event system ?

  • @grombula721
    @grombula721 3 ปีที่แล้ว +1

    Great video! How would you recommend changing the charactermovement script to move the character based on the position of a cinemachine camera

  • @Gichanasa
    @Gichanasa 3 ปีที่แล้ว +1

    Thank you, sir, for this excellent tutorial! Is it possible to use the new visual scripting to achieve the same result?

    • @Gichanasa
      @Gichanasa 3 ปีที่แล้ว

      @@iHeartGameDev Thank you for the reply! My colleagues and I are visual designers who are weak with coding, but decent with visual scripting of all sorts... Grasshopper, Houdini, etc.. it would be very helpful to see a tutorial from you on the topic.

  • @donutxd3903
    @donutxd3903 2 ปีที่แล้ว

    decided to try it out.

  • @LILTEXAN
    @LILTEXAN ปีที่แล้ว

    how do you add camera view to right thumb stick?

  • @synapticstudios6388
    @synapticstudios6388 4 ปีที่แล้ว +2

    Unsure if this is a bug or not, but I found that using "Value" as an Action Type with my controller causes the PlayerInput to 'stick', even when no value was actively being applied to the Control Type Vector2 of Movement. Switching to Pass-Through resolved this issue.

    • @NhanTheHo
      @NhanTheHo 4 ปีที่แล้ว +4

      ​@@iHeartGameDev By stick, he ment the left analog stick on your controller for the input system.
      I've also encountered the same issue, since Vector is a float, it doesn't always round back to exactly 0...
      in the code you written "movementPressed = currentMovement.x != 0 || currentMovement.y != 0;"
      this causes potential issues since it specifies it to be exactly 0 but floats don't always exactly land at zero
      One way to solve this is to use Math.Round but that doesn't always work since the analog stick return to the center too fast may not always recognize the vector as (0, 0).
      Synaptic Studios suggestion fixed this issue by setting it to pass-through from the input system and it worked wonderfully!
      Your guides have also been amazing Nicky! Very detailed! Hoping to see if you can make a third person shooter in the future!

    • @eurojank5162
      @eurojank5162 3 ปีที่แล้ว

      Thank you for this comment! I just couldn't figure out what was causing this behaviour, didn't even know what to google - this fixed it completely (and thanks to Nhan for describing why it happens)

  • @andrewwhitton1812
    @andrewwhitton1812 3 ปีที่แล้ว +1

    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

  • @kevinsetiono9933
    @kevinsetiono9933 4 ปีที่แล้ว

    You explained it very well.

  • @prathameshgaikwad7550
    @prathameshgaikwad7550 ปีที่แล้ว

    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.

  • @vishnudevvasudevanpillai2461
    @vishnudevvasudevanpillai2461 2 ปีที่แล้ว

    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.

  • @tarunkumar6181
    @tarunkumar6181 2 ปีที่แล้ว

    The tutorial is dope but where is the generated new input script attached?

  • @RehtseStudio
    @RehtseStudio 4 ปีที่แล้ว

    I like to see how other use the new Input System, well done Nicky👍.

  • @juanpablocoloradotuberquia7361
    @juanpablocoloradotuberquia7361 3 ปีที่แล้ว

    such a good explanation.

  • @Arab_GameDev
    @Arab_GameDev 4 ปีที่แล้ว +1

    thank you bro keep going up

  • @holymowmusichd8229
    @holymowmusichd8229 ปีที่แล้ว

    Can Armor X Pro used in programming the motion of 3 d characters in unity 3d ?

  • @dranora9208
    @dranora9208 3 ปีที่แล้ว +1

    Can you explain me how we can block that the character pass through the walls when using an animation with root motion ? :(

  • @oddlytimbotwillison6296
    @oddlytimbotwillison6296 4 ปีที่แล้ว

    Nicely done! I've been very eager for a new input system, the old one was so bad for local co-op games.

  • @rubensteinhauer2442
    @rubensteinhauer2442 2 ปีที่แล้ว

    Does soft soft co with the samples? And are these copyright free?

  • @CodeLife_12
    @CodeLife_12 2 ปีที่แล้ว +1

    Anyone else has an issue where the character keeps moving if the stick is let go too fast? Like if I slowly bring to stick back to (0,0) the character stops as expectet but if I quickly pull my thumb off, the character keeps walking even if I'm not touching the stick anymore. Does somebody have an idea what could be the issue?

    • @iHeartGameDev
      @iHeartGameDev  2 ปีที่แล้ว +1

      Hey! Try adding the .cancelled callback

    • @CodeLife_12
      @CodeLife_12 2 ปีที่แล้ว +4

      If somebody has the same problem and sees this, I found the solution!
      I added this bit of code :
      input.CharacterControls.Movement.canceled += ctx => {
      currentMovement = Vector2.zero;
      movementPressed = false;
      };
      If I understood correctly, the issue was that the "canceled" event was called before the (0,0) value was registered and so movementPressed wasn't updated. Updating it here fixes that problem.

  • @catastic9394
    @catastic9394 9 หลายเดือนก่อน +1

    Thank you

  • @macleodgordon
    @macleodgordon 3 ปีที่แล้ว

    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.

  • @samyam
    @samyam 4 ปีที่แล้ว +1

    Great video! Tons of useful information 🙂

  • @siba2893
    @siba2893 3 ปีที่แล้ว

    This was an amazing tutorial

  • @ajithraj1206
    @ajithraj1206 3 ปีที่แล้ว +1

    I've a problem with the joystick..... Whenever I move a joystick (little bit) the speed of the player is slow but when I move joystick farther speed is normal...I'm using 2D rootMotion