2D CHARACTER MOVEMENT IN UNITY 🎮 | Rigidbody2D Movement And Jumping In Unity | | Unity Tutorial

Поделиться
HTML-код
  • Опубликовано: 21 сен 2024

Комментарии • 562

  • @protophase
    @protophase 2 года назад +156

    Finally someone who acknowledges the importance of why. So many videos that I have watched just instruct you WHAT to type in to the code and which checkmarks you should have but never do they tell you WHY, which makes the information totally useless because you can never use it in any other situation.

    • @alexandratrenkova9339
      @alexandratrenkova9339 Год назад +4

      Give a man some food,, and he'll live for a day. Teach a day how to fish, and he'll survive for years. So important!

    • @vihansgaming
      @vihansgaming 10 месяцев назад +1

      yeah i just watch tutorial nothing what i learn from but in this video he is telling everything
      this video is awesome

    • @wingingglobe4095
      @wingingglobe4095 9 месяцев назад +2

      This is exactly what made me give up on game development before. You can watch a tutorial and implement everything correctly but if the video doesn't explain, you still don't understand anything

  • @bubblegum1653
    @bubblegum1653 Год назад +3

    you're a life safer. Most tutorials dont explain what we're coding and when i did something wrong i wouldnt know how to fix it. But you explained very well. thx

  • @leet37a9
    @leet37a9 2 года назад +28

    This, by far, actually taught me something. Thank you so much for making this video, Dani. At the very least, I think I've learned some core concepts of the codes you have introduced here.

  • @jorgesanzana4262
    @jorgesanzana4262 10 месяцев назад +3

    best tutorial ive seen on programming for beginners!! like any new subject youre completely unfamiliar with, there's a whole universe of things you need to learn in order to make your own mental image and understanding of the topic in order to really learn stuff instead of memorizing. the way its explained on this video really helps with that

  • @almaaanea
    @almaaanea Год назад +7

    This is the first player movement script that REALLY worked for me, that I understood. I'm relearning Unity after I took a huge break from coding so thank you so much for helping me bounce back

  • @dylanc5636
    @dylanc5636 Год назад +22

    This is the first video of yours I've watched, and the best tutorial I've seen that (as many others have pointed out) actually explains WHY you're writing a certain line of code and how everything interacts with each other as opposed to just telling you what to write. I ended up taking notes on paper and also adding notes into the script so I can go back and remember what the fields and everything are actually doing.
    Thanks SO much for this, subscribing and probably devouring all the rest of your videos!

  • @dazza22
    @dazza22 2 года назад +3

    finally a tutorial that actually EXPLAINS why and what the code that we need to type does. I've been looking all over for this. Thanks so much!

  • @zoem6195
    @zoem6195 Год назад +4

    I've never been so thankful in my life. I've spent over 20++HRS trying to fix my jumping mechanics going through soo many tutorials hoping it would fix my issue and THANKFULLY this has been the one and only that has fixed my issue. Thank you soooo much!!! I am subscribing and liking this video and keeping this Channel as my go to for my issues. Its so informative especially for a beginner. I can't help myself but to thank you again once more.

  • @N9TN9
    @N9TN9 2 месяца назад

    I have watched so many tutorials on youtube by now and this is by far the best one! you explain things so thoughtfully and clear. keep it up, you gained a new subscriber!

  • @FondsRL
    @FondsRL Год назад +1

    It finally worked! After two months of watching tutorials he moves!!!!!

  • @francoisdebruin6293
    @francoisdebruin6293 Год назад +1

    Na this dude is legit he makes sure to think about what would a new Dev be thinking he does not only think from an experienced point of view subbed man

  • @AmierAzzeal
    @AmierAzzeal 11 месяцев назад +4

    Its Great to see someone explain things and does'nt just gloss over it or assume people already know what everything means.

  • @aaronperdue2667
    @aaronperdue2667 Год назад

    I just wanna say ive watched about a dozen different unity / c+ beginner videos and tutorials and this is the first one that has actually TAUGHT me something. Thank you!

  • @Mona-wr9xl
    @Mona-wr9xl Год назад +6

    I want to just say, thank you so much for actually explaining how or why things work as well as the term definitions. This is literally the only channel I felt like I was learning something new, like a lesson rather than a guide or demonstration.

    • @Dani_Krossing
      @Dani_Krossing  Год назад +1

      I'm glad you found them easy to follow :)

    • @GunSpyEnthusiast
      @GunSpyEnthusiast Год назад

      @@Dani_Krossing im getting the " Top-level statements must precede namespace and type declarations. " error and i would know if i did the code right if you pasted the code into your descripton but you didnt.

  • @average337
    @average337 2 года назад +3

    Im just seeing this now after using many other vids that didn't explain as well as yours. I have decided to make a game on spring break, thanks a ton and i'm sure i'll watch more of the vids you have made to help me

  • @thissideofmyworld7216
    @thissideofmyworld7216 2 года назад +3

    I am getting intetested in game dev and you are beautifully teaching me the way through it. I thank you so much, I devoured this video in the best sense of the term. It shows the crazy amount of devotion you have to teaching.
    Thank you once more.

  • @abdallahgamer6298
    @abdallahgamer6298 Год назад +1

    Actually this is the tutorial that I am going to stick with and ur channel is great keep going

  • @goomba8170
    @goomba8170 Год назад

    Thank you so much for actually explaining the code here, it’s purpose and why it’s being used in this instance. The phrase ‘give a man a fish, and he’s fed for a day, teach a man to fish, and he’s fed for a lifetime’ comes to mind. Every other tutorial has just been tossing fish, whereas this one has actually managed to teach me something effectively.

  • @meliasnahtony2951
    @meliasnahtony2951 2 года назад +3

    Out of every channel I've looked at, you were the most informative.
    Thank you!

  • @staticplays1871
    @staticplays1871 Год назад

    thank you for explaining how the code works, you don't know how many people make "beginner tutorials" but never actually explain the functions of the code.

  • @jamesjam
    @jamesjam 2 года назад +8

    This walk through is amazing so detialed but still welcoming for new game designer and programers like myself. Thanks so much!!!

  • @kshitizthakur2626
    @kshitizthakur2626 2 года назад

    TNice tutorials is the channel that made start actually creating instead of being intimidated by the software. Thanks for a new form of therapy

  • @stanleyhavok
    @stanleyhavok 10 месяцев назад +1

    Thank you, for taking the time to just explain(with examples) the little things Even when you say your not going to. !

  • @Babtu
    @Babtu Год назад +2

    I just wanne say thank you for the course! You're not only explaining it flawless but you're making it fun!

  • @mrderpyofficial21
    @mrderpyofficial21 6 месяцев назад +1

    finally I get it, I think, it's this player movement video is better than brakeys 2d movement. It's easier and easy to understand. I love this guy.

  • @mahiincheck
    @mahiincheck Год назад +2

    Man u really cool and the way you explained everything deserves a like

  • @md.jannatulnayem4328
    @md.jannatulnayem4328 3 года назад +1

    While I was doing my PHP projects I came to know this channel. I loved those videos.
    I guess I never expressed enough gratitude. Thank you!!!!!!! Well now I am all about C#....I hope we have a long journey ahead 👊

  • @blockybrainz4026
    @blockybrainz4026 7 месяцев назад +1

    i can actually make my game now ty so much love your vids bro!

  • @javierst.claire5651
    @javierst.claire5651 2 года назад

    This is the best free software Ive seen. Respect.

  • @Yurem_
    @Yurem_ Год назад +1

    Thank you Thank you Thank you!! this is so far the most detailed tutorial I've seen

  • @himiko4202
    @himiko4202 2 года назад +6

    This is one of the best videos i've seen for learning this! You really go into detail about what things mean and when you should use them. Thanks alot! I'll definitely recommend this video to anyone i know who wants to get into coding :))

    • @mcnugget4227
      @mcnugget4227 2 года назад +1

      Every time I typed Rigidbody2D in my code it didn't call it, and I have no clue how to fix this. Did something change in the 2022 version or am I making a mistake? I saw your comment was from only one month ago so I was wondering if something similar happened to you.

    • @vagabxndd
      @vagabxndd 2 года назад

      @@mcnugget4227 same thing here, it doesnt call the rigidbody

  • @josephfrost2765
    @josephfrost2765 2 года назад +2

    Even though I knew how the character movement worked this video just helped me a lot with understanding it again. Thank you

  • @archerburger143
    @archerburger143 2 года назад

    Considering the amount of views on this video, it certainly doesn't have enough likes. it deserves so many more.

  • @philipphille5048
    @philipphille5048 2 года назад

    having tNice tutorials tutorial playing when first using soft soft was a godsend. Thank you!!

  • @samkroes4611
    @samkroes4611 2 года назад +2

    Super helpful video! I've been going through this Unity intro series and learning a ton! You are great at anticipating my questions and explaining everything. I watched your pixel art tutorial, and am excited for the C# series too. Thank you so much!! It's hard to believe resources like this are free.

    • @Dani_Krossing
      @Dani_Krossing  2 года назад +2

      You are so welcome Sam. 🙂 I hope I continue to anticipate questions you might have.

  • @meowymeowz1604
    @meowymeowz1604 Год назад

    I love this video
    I just watched it and made my player movement and its so much better than other videos
    Most other videos i would click on, check the comments, and see that they just give you a premade script or tell you what to type.
    This video has wasted hours of my life as i will have to watch your other videos because they are so helpful.
    Thank you.

  • @PROFPANDA-jm7ru
    @PROFPANDA-jm7ru Год назад +1

    The best tuto ever, finally someone I understand and find easy to follow with! Just started out and your video really helped out so much, thank you! cheers

  • @sherwing9054
    @sherwing9054 3 года назад

    I'm gonna come back and thank Dani fully when I sign the contract for C# dev, your videos really helped me pass the technical exams.

    • @sherwing9054
      @sherwing9054 3 года назад

      I got a job as a c# dev, thanks dani, but the pay is minimum wage. Eh, still ok I guess, got some mouths to feed now.

  • @ricomine2pl136
    @ricomine2pl136 2 года назад

    I had a lot of fun follwing the steps in your tutorial and everything worked. Now i can jump around with my little square. Cool!

  • @theoneandonlyginger6098
    @theoneandonlyginger6098 Год назад

    The first time i actually understand what i'm doing, thank you

  • @maka_dev
    @maka_dev 2 года назад +1

    Best guide i've watched about the topic 👍
    Im also learning c# from zero, your video helped a lot, thanks

  • @learnenglishwithstories3571
    @learnenglishwithstories3571 7 месяцев назад

    You are a lifesaver! Thanks for your videos!

  • @_natcho
    @_natcho Год назад

    It was 100% worth the extra time! The information becomes 1000% more useful when you know what’s happening and how you can use the information in future code!!!

  • @Pescatorelreal
    @Pescatorelreal Год назад

    amazing video, i watched millions of videos of unity and none helped but this one was just too good

  • @FisherTPS
    @FisherTPS 3 года назад

    how tf do u not have more views, best tutorial on youtube. YOU NEVER LEAVE ANYTHING OUT!

  • @samuv8864
    @samuv8864 2 года назад

    Oh my lords this was an absolute gold tutorial. (It's bit ironic that I say gold as the character for game I worked on was a golden coin.) I had some troubles first with visual studio and unity not linking well, but then i discovered that I had to use visual studio code and not visual studio it's self. After getting that done following through the tutorial was actually fun and some great time as this was my 3rd day trying to work with unity.
    Also the length didn't really matter it was great getting to know terms and usefull info about unity, as i really wanna learn to use it on my own someday.
    Thank you so much!

  • @radiantbluewolf7436
    @radiantbluewolf7436 2 года назад

    thanks for this tutorial it was the only one i could find that worked with my version of unity and not make me think "wtf is going on"

  • @KingAbodi206
    @KingAbodi206 3 года назад +5

    nice video, keep going. I really like your tutorials

  • @entity1325
    @entity1325 2 года назад

    i've been struggling to find tutorials on unity to fit my mind and yours do a very good job of that, thanks.

  • @me3699-f7f
    @me3699-f7f Год назад +1

    This is really well explained

  • @ItsAkile
    @ItsAkile 2 года назад

    thank you, this should go a long way. I forgot almost everything since the last time I've dabbled, most of my Errors were a "}" placements 😅 but now it works fine, now to apply to some gameplay

  • @lux_5797
    @lux_5797 Год назад

    This is the best Unity tutorial i ever seen , it explains everything and easy to understand

  • @gengatuberofficial7009
    @gengatuberofficial7009 Год назад

    Thank YOU!! I LEARNED THIS AWESOME MOVESETS!!

  • @joshetrtg817
    @joshetrtg817 2 года назад +1

    I'm decided to learn how to dev my own games just for fun, no money interests, I was very excited, I ended even more excited after finishing my first moving box following these first lessons. YOU ARE AN EXCELLENT TEACHER. No redundancy, step by step, nice pace. I'm telling you this and I struggle to learn, I have ADHD, and I didn't struggle at all with your teaching way. I just have a question I'm getting "The referenced script (Unknown) on this Behaviour is missing!" on the console. IDK why, the box is doing everything well. So IDK what the error message means. Thank you!

    • @Dani_Krossing
      @Dani_Krossing  2 года назад +1

      I’m glad you find my videos helpful 🙂 There can be a few issues that causes that error, but they are usually all happening because Unity can’t find something you are asking it to find.
      For example if your script file name doesn’t match the class name inside the file. Which is my best guess on what might be causing your error. Make sure that you don’t change the name of a script file, without changing the class name as well.

    • @joshetrtg817
      @joshetrtg817 2 года назад

      @@Dani_Krossing Thank you I'll check it later, now I'm working on the bone animation with you! I just checked and the message dissapeared, ty!

  • @TeeGeeOfficial
    @TeeGeeOfficial 2 года назад

    this is a fantastic tutorial that assumes no previous knowledge (very much appreciated) thank you!

  • @thatguyelibeats4031
    @thatguyelibeats4031 Год назад +1

    SUPER HELPFUL!

  • @lucapangrazi9217
    @lucapangrazi9217 2 года назад

    I got a giant headache trying to figure out this by myself, im just going to steal this code real quick, thanks

  • @linkdev3916
    @linkdev3916 2 года назад

    this guy is so wholesome i love him

  • @drakebifugha7727
    @drakebifugha7727 Год назад

    I love the way you explain every single detail. You just got one subscriber.
    THANKS
    PLZ make more

  • @toddietubby7450
    @toddietubby7450 Год назад +2

    Thanks, my player was able to randomly jump higher before i used trigger2D to detect instead of collider2D

  • @vinhnguyen-o5z
    @vinhnguyen-o5z 2 года назад

    This is one of the best tutorial, or more like a lessons, on Unity I've ever seen

  • @bluefiregamingandcards
    @bluefiregamingandcards Год назад +1

    A very well made video. You are truly a great teacher for this subject. Thank you.

  • @preciousessien163
    @preciousessien163 Год назад

    I've been looking for this for a very long time!

  • @Couldbeme
    @Couldbeme 2 года назад

    I love how in depth you are

  • @bhartisharma139
    @bhartisharma139 2 года назад

    you are extremely underrated bro. thank you sooo much

  • @davidkirk831
    @davidkirk831 3 года назад

    Awesome vid, filled in lots of gaps for me! Following and downloading all your stuff as well

  • @beastmasterbg
    @beastmasterbg 2 года назад

    Thank you very much for the tutorial. Its easy and simple to follow !

  • @focalgain
    @focalgain Год назад

    Amazing video. Followed it to the end very educational. Thank you for your time and effort you have my support

  • @Nate-i2o
    @Nate-i2o Год назад +1

    thanks this really helped

  • @Viltzu-hk5wh
    @Viltzu-hk5wh Год назад

    I'm the blup guy, this is pog.

  • @gleenngarejo6776
    @gleenngarejo6776 2 года назад

    this video help me a lot for my self study THANKYOU

  • @msv266
    @msv266 2 года назад

    Amazing! Things make so much more sense now

  • @Lyttii_
    @Lyttii_ 2 года назад

    Thanks for explaining everything so in depth!

  • @thedevilchild18
    @thedevilchild18 Год назад

    you are a good king sir 🗽

  • @Justin--ze6qq
    @Justin--ze6qq Год назад

    Brooo you are so good at teaching. Thank you for this

  • @raminlamian6560
    @raminlamian6560 Год назад

    Nice & clear, thanks a lot 🙃

  • @AhmedRamy585
    @AhmedRamy585 Год назад +1

    Fantastic Video

  • @fahmimohamadramadhan3978
    @fahmimohamadramadhan3978 2 года назад

    soft just keeps getting better

  • @mianmasharratmurshed8790
    @mianmasharratmurshed8790 2 года назад +1

    for some reason when i put the code for vertical movement it does not work on unity and it does not say any specific error how can i fix this?

  • @sb12812
    @sb12812 10 месяцев назад +1

    When I go to write the code in C# it doesn't show me an option to connect to Unity. Alongside that it tells me that it is in 'Miscellaneous Files' rather than 'Assembly-CSharp. And when I go to call on RigidBody2D like you do at 18:15 it doesn't connect to anything. Would you know the reason? I also wanted to say thank you for taking the time to make this wonderful video.

  • @shesapirate1306
    @shesapirate1306 2 года назад

    To be honest. I only clicked on this video bc I have watched a 5minute tutorial before which was more or less helpful and I kinda just wanted to see what makes this video so much longer.
    But I get it now ,he actually really explains things. I often see those videos where people are just like :" and then we do that and now we add that and done" which then leaves me wondering how I can make scense of all that.
    This video helps me to understand things a little bit better.😀

  • @cocoduck7745
    @cocoduck7745 2 года назад

    this video solved lot of my probs, thanks man.

  • @mipheus
    @mipheus 2 года назад

    OMG it is perfect for my game! Thank you very much, thats a great tutorial and you can explan very logically and nicee... First attempt i guess I wrote something wrong, but now I wrote the script new and its working perfectly, Instant subscribed!
    (And Im sry if my english is bad xD)

  • @jamesostrander8022
    @jamesostrander8022 2 года назад

    Brackey's 2.0 baby! Nice work.

  • @yashpatel1460
    @yashpatel1460 3 года назад

    Dani you are one of the most hands down to the earth person on RUclips. Your every single tutorials is filled with detail information and I have watch plenty of HTML, CSS, JS & PHP to help myself out specially during when my university didn't taught shit. I am looking forward for this wonderful unity tutorials. I want to become a game dev and i am so grateful that i will be learning unity from you. Please continue to make this absolute quantity tutorials of unity. I have watch many other unity tutorial channels but mostly i find people skipping over lot of important things and i tend to get confused and lost on what am i suppose to do next. I am sorry to say I don't have any money to support you but always remember you have a very special place in my heart as a teacher!
    I just cant say enough but I am sooooooooooo freaking pumped to learn unity from you like Raycasting and other wonderful things in unity c# that I have always found hard to teach to my self.
    THANK YOU BROTHER!!!!!!!!!!!!!!!

  • @JoshWichert
    @JoshWichert Год назад +1

    I have one problem with my code is that if I hold down my jump key I fly to outer space but other than that this has been a great tutorial

  • @gatesaims
    @gatesaims 2 года назад

    i self taught myself photoshop cs6... i wish i knew about tNice tutorials when i was in the self teacNice tutorialng mood

  • @vetrivel.y4740
    @vetrivel.y4740 2 года назад

    In GMS screen select appes and then select Analog app 1 TE. That worked out for .

  • @KarkhaLethe
    @KarkhaLethe Год назад

    THANKS FOR THIS IV BEEN SEARCHING FO SOOO LONG

  • @ratheeshk7809
    @ratheeshk7809 Год назад

    The best explained tutorial ever! And i want to tell...the collision trigger methods not working for me...when i'm press up arrow or w, still my player go up while in air. And also when "is trigger" is not ✅ my player detecting collision and not fall through from platform..when "is trigger" is ✅ my player fall through from platform and going down! I do exact things you do! But I don't know why🙂

    • @ratheeshk7809
      @ratheeshk7809 Год назад

      Edit : Oops! I found i am using only one collider on my player and i am set in that "is trigger " ✅. i found in unity discussions, game objects used as triggers are ignored by physics calculations. So i used exactly the bro did in the video.i add two colliders for player(capsule & box). i set "is trigger" is ✅ on the box collider and not in capsule collider. So all fine. My problem was solved. Thanks @Dani_Krossing

  • @DenizTheUnbeaten
    @DenizTheUnbeaten Год назад

    thx for everything man

  • @peterkim9696
    @peterkim9696 2 года назад

    Love your tutorials dani 🥰

  • @yashraj1928
    @yashraj1928 Год назад

    Hey! Thanks so much for this video!

  • @tlpenguin3758
    @tlpenguin3758 2 года назад

    the 4th and 5th frame of 32:08 is beautiful

  • @LetsPlayCrazy
    @LetsPlayCrazy 2 года назад +4

    Wow! I see you still answering comments after all this time!
    I have followed everything. The only problem is the jumping.
    Since we use GetAxisRaw instead of KeyDown, I can not, for the life of me, make the physics constant.
    Because the boxcollider is below the object, sometimes it adds the force while I am still falling, resulting in a much lower jump, sometimes it checks for collisionExit too late and still registeres the object as "!Jumping", but has already jumped once (resulting in double or tripple inputs), and while I can fix this with a timer, that seems very clunky to me (and the physics problem still applies regardless because the box does not have gravity, so the object will always be in freefall while technicially already being grounded)
    I would really appreciate the help!

    • @Dani_Krossing
      @Dani_Krossing  2 года назад +4

      The issue you are describing is definitely relatable. It usually happens whenever I do non-physics based checks inside FixedUpdate (like !isJumping for example), which causes wonky input register. And you are right, adding a timer is like a band-aid on a broken system hehe.
      My best solutions are:
      Instead of setting "isJumping = true" in the OnTriggerExit method, just delete that OnTriggerExit and instead put that line of code under the AddForce line in your FixedUpdate where you perform the jump. This is a much better solution, and I should have shown that instead in the video, since it registers the jump as it happens.
      Another thing causing this could be the Trigger under the player being too large, both in the vertical, but also in the horizontal direction. Since the trigger accidentally touches something when it isn't supposed to. In my video I should have made the trigger slightly narrower, so it doesn't go all the way to the edge of my character.

    • @LetsPlayCrazy
      @LetsPlayCrazy 2 года назад

      @@Dani_Krossing I see!
      I might just be too much of a newbie to understand where I made a mistake, because I did as you said and now have another host of problems :D
      Question:
      What is the benefit of using continous input instead of GetKeyDown/Up?
      Because at least with jumping it seems FAR easier to implement.
      PS: what fixed most of my issues (just trial and error :D) was setting my velocity.y to 0 upon triggerenter.
      It seems the built in gravitation does not like super quick changes in forces :D

    • @Dani_Krossing
      @Dani_Krossing  2 года назад +1

      Oh did you remember to set a Linear Drag in the inspector? That will help stopping your character as well. 🙂
      Regarding GetAxisRaw vs GetKey. Essentially I think the main difference is that you can set multiple keyboard buttons to each axis in the project settings. Where as GetKey listens for a specific keyboard button. And then GetKeyDown does the same as GetKey, except it just listen for one press per button click. 🙂
      So alternatively just use GetKeyDown for jump as well.

  • @lunis9066
    @lunis9066 2 года назад

    thank you very much! perfect tutorial let´s help you a bit with the YT algorithm :)

  • @cookiecrayon
    @cookiecrayon 2 года назад +3

    This is a great tutorial! I've been searching for a way to use addForce to move a character around and this has been really helpful! With regards to the 3 different ways of checking if the character is grounded before it can jump, is there much of a difference between using raycasts, overlaps and layer masks, and the collision detection method that you used? Is one easier to control than the other or does one perform better than the other? Thanks again for the great vid!

  • @nhuquynhnguyen4349
    @nhuquynhnguyen4349 2 года назад

    25:55 i laugh like crazy in the middle of the night lol, yes it do fly to hell XD
    btw as a newbie thanks a lot for making instructions and actually tell us "why" we do it, please keep making these useful thing! THANK YOU SIR!

  • @kinlushchristo5126
    @kinlushchristo5126 2 года назад

    purchased soft soft was because there are so many resources and remake templates out there to help understand how people have

  • @localuhu8657
    @localuhu8657 Год назад +2

    Hey, I'm new to game development so your tutorial is super helpful but I have trouble implementing what you've shown. I think I have copied everything but I can only move to the right but not to the left why could this be?