ULTIMATE 2D Platformer Controller for Unity

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

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

  • @Pandaluf
    @Pandaluf 4 месяца назад +5

    I absolutely love your tutorials they have been SO helpful in setting up my game cannot thank you enough for these

  • @og_jankypanky
    @og_jankypanky 13 дней назад

    Great tutorial!!
    @18:00 you mention trying to account for max fall speed to DrawJumpArc curve. I added a float terminalVelocityTime = Mathf.Abs(MoveStats.MaxFallSpeed/MoveStats.Gravity), just before you start iterating timeSteps.
    Then in the descending else section first remove the last line. Your horizontal velocity will be the same throughout so you can calculate a total horizontal displacement of new Vector2(speed, 0) * descendTime (just adding this to displacement is fine) then:
    If your descendTime is less than that terminalVelocityTime you add 0.5f * new Vector2(0, MoveStats.Gravity) * Mathf.Pow(descendTime, 2) to displacement
    Else you'll add 0.5f * new Vector2(0, MoveStats.Gravity) * Mathf.Pow(terminalVelocityTime, 2) for the gravity accelerated component and then add new Vector2(0, -MoveStats.MaxFallSpeed) * (descendTime - terminalVelocityTime) for the remaining fall at terminal velocity.

  • @толькохардкор-г7е
    @толькохардкор-г7е 3 месяца назад +2

    Dude, you have no idea how much you helped me. Thank you very much! We need more of these videos! :)

  • @Firestone-Games
    @Firestone-Games 4 месяца назад +5

    Awesome Tutorial, as always.

  • @siimmae4009
    @siimmae4009 17 дней назад

    really great tutorial. thank you!

  • @NameThinkerGames
    @NameThinkerGames 4 месяца назад +7

    Thanks for sharing that, it certainly would be helpful for beginners who wants to build a platformer. Although I've noted few things in your tutorial which will make it certainly harder to support and add more features to the controller. Since you're changing velocity of rigidbody directly without using AddForce, you are basically killing possibility to interact with other objects such as Surface effector for example, since it applies a force to a rigidbody in a specific direction, it also will be hard to make a moving platform work flawlessly with that, since you would have to figure out how to add velocity of platform to the player and conserve momentum during jumps. Overall good job, keep it up

    • @Razofgal
      @Razofgal 4 месяца назад +1

      A "simple" solution to the moving platforms is to make the player a Child of the platform when they hit it, and dechild the player when they jump - this wont save momentum though.

  • @beatrageGameSalad
    @beatrageGameSalad 4 месяца назад +2

    Nice tutorial!

  • @cadafinn
    @cadafinn 3 месяца назад

    tus videos me ayudan a seguir adelante, hay muchas cosas que debo aprender de unity, Me encanta personalizar la jugabilidad del personaje.

  • @libberator5891
    @libberator5891 4 месяца назад +4

    18:12 OnDrawGizmos isn't called in a Build, so turning it off or leaving it on won't make a difference.

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

    Great walkthrough!

  • @fireraccoon_
    @fireraccoon_ 4 месяца назад

    Oh. That is super cool and nice!

  • @veerajukuri
    @veerajukuri 4 месяца назад

    definitely going to be looking over my jump after watching this, all the adjustability seems really useful. i have to ask though, do you have thoughts on implementing movement via AddForce instead of straight velocity changes? seems to me like implementing knockbacks or such would be a lot simpler if movement is done with AddForce? really grateful for all the videos so far, they've helped tremendously in setting up various systems.

  • @douick
    @douick 2 месяца назад +1

    thanks you for your awesome tutorial, but how do you handle inclined plane like stairs ?

  • @blasterxt9
    @blasterxt9 Месяц назад

    Buddy explains the new input system of unity

  • @soufianebenamer7585
    @soufianebenamer7585 4 месяца назад

    Please can you zoom in a little bit the script that I can see it clairly and thank you so much for these great tutorials .

  • @AnEmortalKid
    @AnEmortalKid 4 месяца назад

    This reminds me of the plarformer toolkit by GMTK

  • @job1481
    @job1481 Месяц назад

    Hey thanks. Is there a reason why you didn't switch the rigid bodys to kinematic if you don't need the actual dynamics like you said in the beginning?

  • @eva-nf9fl
    @eva-nf9fl 2 месяца назад

    I've copied your code to a T but my character flips dramatically to the other side of the screen and doesn't move. Not too sure what I did wrong. It doesn't work.

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

    Great Platformer Tutorial! Although, it took a while before I was able to type all the lines of code.
    I had a few issues when implementing this, first I noticed you didn't talk about the camera and what type of camera to be used, I'm using cinemachine but I'm getting weird results when moving the player, the camera is a bit wobbly and when I press Left Arrow Key or A key, the camera moves to the right instead of the left not following the player, but when I press the Right Arrow Key, it works at it should. I'm not sure you factored when the player moves left in the PlayerMovement script.
    I also noticed the player keeps jumping when I press spacebar multiple times, the effect of gravity does not really work. I messed with values of MaxFallSpeed, TimeTillJump Apex and some others but it was to no avail.

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

      I also noticed if I press the jump button and immediately hold the right arrow key or D key, the player hangs in the air and is not affected by gravity but if I press the spacebar key when stuck in the air, the player then comes down to the ground.

  • @midniteoilsoftware
    @midniteoilsoftware 4 месяца назад

    Fantastic!

  • @capilover1023
    @capilover1023 17 дней назад

    Gravity works, but the player doesn't move when the keys are pressed. New project, empty scene. I copied everything you did, including your input actions and inspector settings. Unity 2022.3.8f1

  • @josegarcia755
    @josegarcia755 4 месяца назад +6

    this did not work for me. Not sure what i did wrong.

  • @restingsox9022
    @restingsox9022 Месяц назад

    How to do state machine?

  • @werter7779
    @werter7779 Месяц назад

    i guess.. i will can not add an other platformer movement mechanics after all by myself😅

  • @Knife8
    @Knife8 3 месяца назад +1

    can u upload the code?

  • @StressedProgrammer
    @StressedProgrammer 4 месяца назад

    How can i try this?

  • @sandman76_
    @sandman76_ 4 месяца назад

    epic

  • @CoconutButter45
    @CoconutButter45 4 месяца назад

    First