Simple DASH Mechanic in Unity

Sdílet
Vložit
  • čas přidán 13. 09. 2024
  • You can setup a player dash in like 7 lines of code. It's super easy.
    All you need to do is:
    1. Determine if you can Dash
    2. Increase Player move speed for a set duration
    3. Set an optional cooldown to dash again
    4. Allow the player to dash again
    #unity #movement #tutorial

Komentáře • 30

  • @rikm2745
    @rikm2745 Před 8 měsíci +1

    I love the fact you explain what every line does at the end. This makes it clear to me as a total noob exactly what line does what so that I can implement those lines in other methods I'm making. Thank you!

  • @mandamoon9149
    @mandamoon9149 Před rokem +10

    Love the simplicity, only 7 lines of code 🤯 like Bmo says, it’s fun to go fast 💨

  • @Rakadeja
    @Rakadeja Před 2 měsíci

    Alright, subscribing. Your tutorials are very chill. Thanks so much!
    Sometimes I over-complicate things, so when I see a guide like this it helps me to comprehend other ways I can accomplish the same thing.

  • @regys9521
    @regys9521 Před rokem +3

    Glad you are back!

  • @zote1
    @zote1 Před 22 dny +1

    oh my this is so.... love it dude

  • @revmatch6r
    @revmatch6r Před rokem

    Yasssss bmo is back 👏 👏 👏

  • @CodingCenter1
    @CodingCenter1 Před rokem

    Don't mind but CAN I ASK THAT WHY ARE YOU NOT AN ANGEL, BRO KNOWS EVERTHING. THX SOSOSOSOSOSOSOSOSOSOS Much

  • @MajesticMindGames
    @MajesticMindGames Před rokem

    Lovely ❤👍

  • @bigp0y
    @bigp0y Před rokem

    We all know it should've been the red knight in the thumbnail

  • @senordygus919
    @senordygus919 Před 7 měsíci +1

    This methods seems hard to to implement in the new input system, do you have any suggestions?

    • @iR3dyOfficial
      @iR3dyOfficial Před 5 měsíci +1

      If you still want to know
      Use public InputActionReference actionKey;
      And then in the if statement you’ll do this
      If(actionKey.action.triggered)
      This will act like KeyCode Key, but you will be able to select the input action you created

  • @DevAlo
    @DevAlo Před rokem +1

    Hey so I tried adapting the tutorial without the shooting mechanic. I used the movement script and it worked but when I tried to implement the dash my character didn’t move anymore and the dash didn’t work either. Unity also didn’t recognise the KeyCode Term. Any help would be appreciated! :]

    • @idabthereforeiam7479
      @idabthereforeiam7479 Před rokem

      What input system are you using? The new input system doesn't use the .keycode fuction.

  • @whyamihere555
    @whyamihere555 Před rokem

    The player isn't stopping once the duration is over for me, just continuing to slide.

  • @ElDonitazz
    @ElDonitazz Před rokem

    Can you use character controller?

  • @RandomDude00001
    @RandomDude00001 Před 8 měsíci

    Idk but I have notice that if you collide with something like enemies of walls when you dash the player rotates like crazy how do I fix that? And hey any Idea how to put a cooldown GUI for this?

    • @arcadeii
      @arcadeii Před 2 měsíci

      you probably figured this out but im pretty sure you have to check “freeze rotation” in the rigidbody settings ?

  • @Apek44
    @Apek44 Před rokem +1

    My dash speed variable roesnt make me go faster, its the only thing that doesnt work, no matter what i do it stays constant, i coppied everythign down exactly from this video cause i was so frustrated and it still dont work, maybe its clashign with my other movement code but idk

    • @Apek44
      @Apek44 Před rokem

      PLEASE HELP ME BMo IM GOING INSANE TRYING TO FIX THIS BUT BOTHING WORKS

    • @Unknown-nv9so
      @Unknown-nv9so Před 11 měsíci

      Have you gotten it fixed yet

    • @Apek44
      @Apek44 Před 11 měsíci

      @@Unknown-nv9so nope. Gave up on fixing that nd decided to do sum else, sorry

    • @danilroiven2428
      @danilroiven2428 Před 10 měsíci

      I solved it with changing my character movement function to function rb.MovePosition and dashing with increasing value of the speed.
      Like
      rb.MovePosition(rb.position+direction.normalized * speed * Time.fixedDeltaTime); // when player is dashing, speed = dashSpeed, after dash time ends speed = defaultSpeed
      Also it can be done with rb. velocity for both but in my case i did not solve that in a way that gives player little control while dashing. MovePosition method is easier, just increase the speed while dash time is not ended

    • @danilroiven2428
      @danilroiven2428 Před 10 měsíci

      @@Unknown-nv9so I solved it with changing my character movement function to function rb.MovePosition and dashing with increasing value of the speed.
      Like
      rb.MovePosition(rb.position+direction.normalized * speed * Time.fixedDeltaTime); // when player is dashing, speed = dashSpeed, after dash time ends speed = defaultSpeed
      Also it can be done with rb. velocity for both but in my case i did not solve that in a way that gives player little control while dashing. MovePosition method is easier, just increase the speed while dash time is not ended

  • @federicorodriguez8419
    @federicorodriguez8419 Před 8 měsíci

    It works fine for me, but I can't run the dash diagonally when I press the up-left and down-right keys, but it works when I press up-right and down-left. Does anyone know why this happens?

    • @arcadeii
      @arcadeii Před 2 měsíci

      this is happening to me too, but only with up left and only on the arrow keys, works fine for wasd

  • @LaughingMan44
    @LaughingMan44 Před rokem

    is having a coroutine in update not seen as a bad idea?

    • @Apek44
      @Apek44 Před rokem

      Why would it be?

  • @PeterSmith-pg7oi
    @PeterSmith-pg7oi Před rokem

    "PromoSM" 😉