Ultimate 2D Platformer Controller in Unity (source code provided)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
celeste and super meat boy are considered to be the gold standard of 2d platforming that's because they go beyond just a simple directional movement and a satisfying jump they're good platformers because they use a lot of invisible tricks in their physics in order to create the illusion of tight controls i recreated all of these invisible tricks in this unity player controller and i'm not only going to tell you how it works but you can also go and download the source code from the description below completely free to use in your game this controller is using entirely custom made physics as you can see no rigid body or collider is in sight anyway let's jump in and cover these invisible and not so invisible tricks variable jump height releasing jump early gives the player control over the height of the jump this is done by adding additional downward force to the character when the player releases jump apex modifiers at the apex of your jump you're given a moment of anti-gravity as well as a minor speed boost this gives you great jump control and allows you to easily land where you intend here's an example of it with exaggerated values jump buffering lets you queue up the next jump before actually hitting the ground this is possibly the most vital hidden feature of a good controller if the player presses jump and the character just sits there it's going to feel like garbage coyote time lets you execute your jump even after leaving the platform just for a few milliseconds this is accomplished by noting when the character leaves grounded and checking to see if the jump was pressed within the coyote threshold clamped full speed so losing complete control over the character when falling sucks clamping the full speed at just the right amount provides the ability to dodge or land on platforms easier it also allows the level designers to incorporate falling as a key mechanic in the game and lastly edge detection instead of hitting your head on the corner and bouncing right down to the ground i nudged the player ever so slightly in the direction they intended to go this works the same for ledge catching two if you jump for a ledge and miss it by an inch the controller will be a little forgiving and nudge you up this is accomplished by nudging them in the opposite direction for a few frames while respecting their current horizontal movement so when it comes to platforming that feels good i can't really describe that with words so you'll have to go try for yourself the link is down below and that's also where you can download the source code if you want to use this in your game i've added the ability to toggle the invisible tricks on and off so you can feel the difference they make first hand and oh yeah if you're feeling confident come over to the discord and share your fastest run time i'm not going to tell you my best time but all i can say is a sub 9 second run is possible like the video subscribe to my damn channel and i'll see you next time you
Info
Channel: Tarodev
Views: 274,191
Rating: undefined out of 5
Keywords: 2d player controller, platformer, unity platformer, unity controller, unity player controller, how to make controller, how to move unity, unity 2d tutorial, make a player move, custom physics, unity2d, unity3d, controller tutorial, platformer tutorial, platformer controller, unity 2d tutorial movement, 2d player controller script unity
Id: 3sWTzMsmdx8
Channel Id: undefined
Length: 2min 58sec (178 seconds)
Published: Fri Jan 14 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.