🎬Just launched the Sequel: ruclips.net/video/KKGdDBFcu0Q/видео.html Discord: discord.gg/W5vE5WKXYH Try out the examples: dawnosaur.itch.io/platformer-examples
this is, quite literally, EXACTLY what I was looking for. I wanted to make Celeste-esque physics and didn't even have to search specifically for Celeste to find this.
Maddy has made a post on medium about how celeste physics works. It does not work using forces. It uses speed/velocity vectors to calculate movement and exact positions on a tilemap (due to it being pixel art, madeline cannot move half a pixel etc), obviously its a lot more complex than that, but I can confirm it does not use forces as such. The concept is the same however, you do want acceleration and deceleration, but you can achieve it without forces.
@@huseyinakkoc1062 The line of code in question is as follows: csharp copy code float accelRate = (Mathf.Abs(targetSpeed) > 0.01) ? acceleration : deceleration; This line of code is inside a FixedUpdate() function in Unity and is responsible for calculating the acceleration rate (accelRate) based on the target speed (targetSpeed), acceleration (acceleration) and deceleration (deceleration). Next, we will break down the line of code to understand how it works: Mathf.Abs(targetSpeed) > 0.01: This part of the code checks if the absolute value of targetSpeed is greater than 0.01. Mathf.Abs() is a static function of the Mathf class in Unity that returns the absolute value of a number. In this case, you are checking if the targetSpeed is greater than a minimum value of 0.01. This is used to determine if the object should speed up or slow down. ? acceleration : deceleration: This part of the code is a ternary operator that determines the value of accelRate based on the result of the previous condition. If Mathf.Abs(targetSpeed) > 0.01 is true, then accelRate will be equal to acceleration. Otherwise, accelRate will be equal to deceleration. In short, this line of code sets the acceleration rate (accelRate) based on the target speed (targetSpeed). If the target speed is greater than 0.01, the acceleration value is used. Otherwise, the deceleration value is used. Yeah I used ChatGPT
Let me just say man, of all the player controllers I've implemented, when I finally got this working, it is by far the best feeling controller I've ever made. I'm more of a Visual Scripting guy so it took me a little time to translate your system here, but DUDE! Thank you so much! This is now going to be my designated method for player movement! You rock!
If you like visual scripting, what you can do is making modular c# code and make specific cisual editors for your use case (I know it's hard, but it's also weirdly fun)
Well, I spent many hours looking for a good and also beginner-intermediate 2D platformer movement system for Unity and finally found this. Now this is a quality content. The video is easy to understand, and the used concepts are really well-explained. Provided github code is well documented and easy to understand with some Unity documentation digging, also great for adapting by using scriptable object for holding movement parameters. I hope you will put here more useful videos like this. :)
Man, I've been using Unity for quite a long time this is literally the BEST video I've ever seen about platformer movement. Glad youtube showed this on my homepage.
The new input system's so cool! It's not super well implemented in the code right now, but when I get round to adding some new features, I'll try to tidy it all up and make it all fit nicely :D
@@DawnosaurDev and for those who had issues like me implementing the handler and control files and movement scripts, you will need to go into Edit-> Project Settings and then Player and scroll down to the configuration section and change Active Input Handling from New or Old into "Both" in order for the current code to work.
Really nice explained. Many people which program in unity do not realize how important all of these mechanics are and you really explained all. Edit: And the fact that you explained them IN CODE. Dude you need more subs.
The quality of the videos. The music and videogame taste. The smooth explaining. There's no reason NOT to be your 500th subscriber! :D Congratulations, underrated tutorial guy! And..well..thanks! XD
I remembered seeing this video 2 times before, and I remembered it was so simple and informative. And today I am making my first game, and I wanted the controls to feel as good as possible, and then I remembered this video. I searched up something like "Video game movement analysis", and I found it!
Finally someone who truly explains how to make proper player movement instead of making something in 20 minutes and showcasing it! Great video, very useful
yo this is a really nice solution; I've always had an issue with figuring out how to get physics-based movement to not feel so sluggish, and the scaling-force-by-difference-from-target-speed thing you have here seems to work pretty well
thanks man. this is awesome. there are so many ways to do this but none of them feel as nice as i would like. I havent tried your way yet but it takes into account a lot of factors that i havent seen considered elsewhere. well done!
I just started developing and designing games 4 months ago, I'm about to tackle my first platformer in the next few weeks as my next project. This is explained so well and i understood 100% of it! I'm so proud to be able to look at the code now and understand what it means and I'm so happy to be at a point where if i do end up copying this code, it wont be blindly copy pasting it. I'm still not at the point where i can come up with things like this myself but i can definitely tweak a few things and understand the effect they have and my reasoning for them. Thank you for making this video! i subbed and I'm looking forward to watching many more of your future videos :)
This is a very well done tutorial! It covers a lot of ground and gives plenty of code examples for me to replicate. Thank you and keep up the good work!
This needs to be said right now... This is the best video ever made on youtube, it is so helpfull and so full of information, i would pay money for this information, because im in need of movement system for my 2D Metroidvania
a year late, but howly this is EXACTLY what i need. I want to make a snappy movement but I want it to still able to be affected by AddForce. Thanks a lot dude you just gained a subs!!!!
Please keep making great videos like this one! They are well-edited, concise, and pack a lot of useful information in a short amount of time! Also, you explain things incredibly well!
Wow. This video is very well made and informative. Congrats dude! For some feedback, I would suggest adding some diagrams when explaining the coding parts to break up some of the visual monotony. The video flows super well, while keeping a steady pace. Subbed, fantastic job!
@@DawnosaurDev We are making a 2d platformer in unity for our final project in my game design class, and my game really benefited from less floaty controls
Hi, thank you for this video. Great to find a different way to move than the usual rb.velocity = ... Also, good to see that you use the new input system. M. D.
I can't believe I missed this tutorial. I used to see this video pop up a lot but always assumed I'd seen it already. God damn it all. I've been squinting at my player's jump. I've gotten it down using velocity instead of add force, but there was always something off about it. Like it didn't feel natural. And the code to control things like gravity, deceleration and acceleration is really messy with velocity compared to that clean force code. Thank you.
The same tutorials on RUclips are repeated over and over again, using the same methods, and 99% of them are very basic tutorials. Professional and high-quality tutorials like this are rare and must be supported.
Wow you're insane man. one of the best video I've seen from this subject. Hope you're gonna continue posting some other tuto (yea I know my english is very bad 👀)
i always thought i needed to use kinematic and build a whole physics system to be able to make this kind of controller. As i'm making a small project (which is basically a celeste rip-off let's be honest) this video is helping me, and will help me get a better understanding of unity physics system. you are too kind. Thanks man. i mean it.
Just realized that I never left a comment on here, anyways, this video is amazing! Everything is explained very well and the visuals really helped to explain the code. Thank you.
I finally caved and decided to just use your movement tutorial, I tried for at least 8 to get and use my own movement system through the power of knowing a highschool amount of math and physics, this one works so much better lmao, at least I tried, good work with yours and thanks
This is so awesome! I've been looking for a way to create a 2D platform character controller that works with Physics for a long time but just couldn't seem to find any good tutorials or examples online. I downloaded your project and was so happy at how clean and tidy the code and the scene are! Thank you so much for the amount of work you put into this! Have you thought about creating a step-by-step tutorial on how you created the code for the playerMovementImproved script?
🎬Just launched the Sequel: ruclips.net/video/KKGdDBFcu0Q/видео.html
Discord: discord.gg/W5vE5WKXYH
Try out the examples: dawnosaur.itch.io/platformer-examples
WTF That reply was so fast!!!
this is, quite literally, EXACTLY what I was looking for. I wanted to make Celeste-esque physics and didn't even have to search specifically for Celeste to find this.
Happy it helped!
Maddy has made a post on medium about how celeste physics works. It does not work using forces. It uses speed/velocity vectors to calculate movement and exact positions on a tilemap (due to it being pixel art, madeline cannot move half a pixel etc), obviously its a lot more complex than that, but I can confirm it does not use forces as such. The concept is the same however, you do want acceleration and deceleration, but you can achieve it without forces.
@@Verdal_JG Isn't it incorrect to say Madeline cannot move half a pixel? Since strats like ceiling pop rely on manipulating her subpixel position?
@@beri4138 forgot to specify visually, obviously subpixels exist but visually the game only uses integer values
@@Verdal_JG I didn't realize subpixels can exist visually
Wow, even though I'm not a game dev, everything was so well explained and easy to understand. Also great editing ;).
Fancy seeing you here
@@DawnosaurDev ;)
accelRate = (Mathf.Abs(targetSpeed) > 0.01f) ? acceleration : decceleration; what is that ? can you explain
@@huseyinakkoc1062 The line of code in question is as follows:
csharp
copy code
float accelRate = (Mathf.Abs(targetSpeed) > 0.01) ? acceleration : deceleration;
This line of code is inside a FixedUpdate() function in Unity and is responsible for calculating the acceleration rate (accelRate) based on the target speed (targetSpeed), acceleration (acceleration) and deceleration (deceleration).
Next, we will break down the line of code to understand how it works:
Mathf.Abs(targetSpeed) > 0.01: This part of the code checks if the absolute value of targetSpeed is greater than 0.01. Mathf.Abs() is a static function of the Mathf class in Unity that returns the absolute value of a number. In this case, you are checking if the targetSpeed is greater than a minimum value of 0.01. This is used to determine if the object should speed up or slow down.
? acceleration : deceleration: This part of the code is a ternary operator that determines the value of accelRate based on the result of the previous condition. If Mathf.Abs(targetSpeed) > 0.01 is true, then accelRate will be equal to acceleration. Otherwise, accelRate will be equal to deceleration.
In short, this line of code sets the acceleration rate (accelRate) based on the target speed (targetSpeed). If the target speed is greater than 0.01, the acceleration value is used. Otherwise, the deceleration value is used.
Yeah I used ChatGPT
Let me just say man, of all the player controllers I've implemented, when I finally got this working, it is by far the best feeling controller I've ever made. I'm more of a Visual Scripting guy so it took me a little time to translate your system here, but DUDE! Thank you so much! This is now going to be my designated method for player movement! You rock!
Thanks so much, that means a lot. Glad it was helpful :D
would love to see the visual script version of this!
If you like visual scripting, what you can do is making modular c# code and make specific cisual editors for your use case (I know it's hard, but it's also weirdly fun)
This is exactly what I needed! A video on advanced movement! I was having loads of issues previously, and this fixes them all! Thanks so much!
I was looking for something like this for days. Really well-made video.
Well, I spent many hours looking for a good and also beginner-intermediate 2D platformer movement system for Unity and finally found this. Now this is a quality content. The video is easy to understand, and the used concepts are really well-explained. Provided github code is well documented and easy to understand with some Unity documentation digging, also great for adapting by using scriptable object for holding movement parameters.
I hope you will put here more useful videos like this. :)
This is perfect. Working on my first game with my son. Our movement is big standard and feels awkward. Thank you so much!
Man, I've been using Unity for quite a long time this is literally the BEST video I've ever seen about platformer movement. Glad youtube showed this on my homepage.
Wow, thanks so much! Happy it helped :D
Actually crazy how much information you put in this video while keeping it short AND understandable. Really really great video!
"accelRate = (Mathf.Abs(targetSpeed) > 0.01f) ? acceleration : decceleration;" what is this can you pls explain ı did not get it
2:07 the most beautiful 4 lines of code I have seen in my life
Made me smile!
agreed
Your video is so good that I managed to use your solution for 3D, as well as adapt your code to have momentum like Sonic games!
May I ask how you converted the Run method into 3D? I tried to, but it caused the character to accelerate exponentially out of control.
Haven't looked at the code, but from the looks of the listed files, you are using the new Input System....thank god!
The new input system's so cool! It's not super well implemented in the code right now, but when I get round to adding some new features, I'll try to tidy it all up and make it all fit nicely :D
@@DawnosaurDev and for those who had issues like me implementing the handler and control files and movement scripts, you will need to go into Edit-> Project Settings and then Player and scroll down to the configuration section and change Active Input Handling from New or Old into "Both" in order for the current code to work.
Really nice explained. Many people which program in unity do not realize how important all of these mechanics are and you really explained all.
Edit: And the fact that you explained them IN CODE. Dude you need more subs.
Thanks a lot for this tutoriol. I tried so hard to make a good platformer movement and watch a lot of videos. Yours is the best.
finally a professional tutorial about unity player movement, thanks!
This is amazing. Really hope you keep up with these. Great job!
The quality of the videos. The music and videogame taste. The smooth explaining. There's no reason NOT to be your 500th subscriber! :D
Congratulations, underrated tutorial guy!
And..well..thanks! XD
🥳 Thanks so much! Super happy you enjoyed it, hope it was useful :D
Absolute S tier video. I was wondering why my movement felt so stiff and floaty and this improved it by sooo much
had an absolute blast watching through this video for 3 days getting everything just right. Great video
Wow, I really like that, I've been looking for this video for a long time
I remembered seeing this video 2 times before, and I remembered it was so simple and informative. And today I am making my first game, and I wanted the controls to feel as good as possible, and then I remembered this video. I searched up something like "Video game movement analysis", and I found it!
This video is so high quality, excellent job! Looking forward to more
This is the best Player Controller video I’ve seen. Thank you so much!
This is very nice way of using RB but still respecting it's velocity variable by keeping it untouched.
FINALLY A GOOD VIDEO THAT SHOWS A DIFFERENT WAY TO MOVE, THANKS DUDE
Thank you!
No thank You for watching :D
Finally someone who truly explains how to make proper player movement instead of making something in 20 minutes and showcasing it! Great video, very useful
yo this is a really nice solution; I've always had an issue with figuring out how to get physics-based movement to not feel so sluggish, and the scaling-force-by-difference-from-target-speed thing you have here seems to work pretty well
Great tutorial! There aren't many others that are targeted for upper beginner / intermediate creators! Keep them coming man!
Thanks a lot! Yeah, i'm loving working on these style videos : D
Great video, I'm no game dev but I still feel like I learnt something - and the editing was really great too!
Hey, you look familiar :D
@@DawnosaurDev 👀
Thank you, this made my platformer feel even better to play!
Awesome video ! You're teaching so much in such a short amount of time, while still going deep when needed.
Very well explained. Glad I found this
This was SO HELPFUL!!!
Thank you and please keep making more tutorials!
Damn i finally found what i was looking for. please keep up the good work!!!
Happy it was helpful!
Man you deserve a lot of love! This video has been extremely helpful. Hope you'll keep making more tutorials and content like these. Awesome work!
Thanks so much, yeah hoping to make a V2.0 at some point :D
This is explained so clearly, I couldn’t have done it better myself. Thank you! :D
Glad it was helpful :D
One of the highest Quailty gamedev tutorials i ever seen
Great video and of a higher quality than a lot of other Unity tutorials I've seen. Looking forward to your next video
I'm from Brazil, and your video is very amazing, I hope it continues.
Very good. ✔
thanks man. this is awesome. there are so many ways to do this but none of them feel as nice as i would like. I havent tried your way yet but it takes into account a lot of factors that i havent seen considered elsewhere. well done!
I just started developing and designing games 4 months ago, I'm about to tackle my first platformer in the next few weeks as my next project. This is explained so well and i understood 100% of it!
I'm so proud to be able to look at the code now and understand what it means and I'm so happy to be at a point where if i do end up copying this code, it wont be blindly copy pasting it. I'm still not at the point where i can come up with things like this myself but i can definitely tweak a few things and understand the effect they have and my reasoning for them. Thank you for making this video! i subbed and I'm looking forward to watching many more of your future videos :)
That's so awesome! Really lovely to hear, hope you have a blast making your platformer :D
Absolute pure jam, thank you for video!
This is a very well done tutorial! It covers a lot of ground and gives plenty of code examples for me to replicate. Thank you and keep up the good work!
Please keep making these types of videos they’re very useful 🙏🙏🙏
Amazing tutorial, You've got yourself a new subscriber! (Also, I just remembered I played you game in the brackeys Game jam, it was super cool)
Thanks so much :D
This needs to be said right now... This is the best video ever made on youtube, it is so helpfull and so full of information, i would pay money for this information, because im in need of movement system for my 2D Metroidvania
a year late, but howly this is EXACTLY what i need. I want to make a snappy movement but I want it to still able to be affected by AddForce. Thanks a lot dude you just gained a subs!!!!
Very very informative. You've made me want to go back and re-adapt this to my own. Thank you.
Thanks a lot, hope it helps!
Please keep making great videos like this one! They are well-edited, concise, and pack a lot of useful information in a short amount of time! Also, you explain things incredibly well!
Thanks so much!
Great visualization on why the issue happens! Good video.
have had alot of probelms with movement fundamentals, thank you so much for this
Quickly and well explained :D
i just need to understand it now xD
>:D this was a really good base for 3d first person movement! thank you so much!
People don’t realise this video worth infinite. Its so good
Thanks! That means a lot :D
Wow. This video is very well made and informative. Congrats dude! For some feedback, I would suggest adding some diagrams when explaining the coding parts to break up some of the visual monotony. The video flows super well, while keeping a steady pace. Subbed, fantastic job!
Thanks so much! Yeah, diagrams are a great idea. I'll definitely be putting that on the to-do list for any sequels i make :D
Very nice video, very educational and also nice, smooth video animation.
Thank you sooo soo much, i have been struggling with movement soo loong and this helped me so much
happy it helped :D
@@DawnosaurDev when new vid
@@RGBA Ooo hopefully in maybe 1-2 weeks (devlog video this time)
@@DawnosaurDev oo nicee
The presentation was excellent and I learned a thing or two. Now do one for the oh so important Dashing!
Thanks, definetly in the next one :D
This is exactly what I needed for the platformer game I'm making, inspired by Celeste and Ori. Earned yourself a sub :D
Самый полезный канал по разработке, который я только находил, божественно! Хочу больше видеоуроков😍
thank you very much for such a masterpiece of a video!!!! only 7 mins, but much more informative and useful than longer ones.
🔥🔥🔥🔥
Thanks so much!
Happy it helped :D
great video, really helped me out w/ my project for school!
That's awesome! What's your school project on if you don't mind me asking?
@@DawnosaurDev We are making a 2d platformer in unity for our final project in my game design class, and my game really benefited from less floaty controls
@@georgemcgurkin7846 Neat! Hope it goes great
Very Awesome video Mate!
Straight to the point with Amazing tips!
RUclips needs more tutorials like this. Keep it up!
Thanks that means a lot :D
Best video I've seen on game development
Thanks so much!
Oh god, this video is really good and helpful. Hope you can keep doing this series.
This video is completely insane, just continue what u doing it's amazing :D Gj mate
Thanks a lot :D
Great tutorial! That's a really clean platformer controller you've made. Can't wait to see what you do next ;)
Thanks so much! Hopefully i'll finishing up my next video soon :D
thank you so much for creating this video it has influenced me to get into coding
Hey! fancy seeing you here ;D
Thank you so much, I'm currently learning unity and wanted to do a super smooth Gameplay, but I only got close, now I can finally implement this :D
Hi, thank you for this video.
Great to find a different way to move than the usual rb.velocity = ...
Also, good to see that you use the new input system.
M. D.
I can't believe I missed this tutorial. I used to see this video pop up a lot but always assumed I'd seen it already. God damn it all. I've been squinting at my player's jump. I've gotten it down using velocity instead of add force, but there was always something off about it. Like it didn't feel natural. And the code to control things like gravity, deceleration and acceleration is really messy with velocity compared to that clean force code. Thank you.
Happy it helped!
Great video! Hope to see your future videos
Great tutorial format! Loved it! :)
This is really good! keep going!!!
Thanks a lot :D
The same tutorials on RUclips are repeated over and over again, using the same methods, and 99% of them are very basic tutorials. Professional and high-quality tutorials like this are rare and must be supported.
Wow you're insane man. one of the best video I've seen from this subject. Hope you're gonna continue posting some other tuto (yea I know my english is very bad 👀)
Such a quality video and the amount of content in it, subscribed! :D
Thanks, can't wait to make another!
i always thought i needed to use kinematic and build a whole physics system to be able to make this kind of controller. As i'm making a small project (which is basically a celeste rip-off let's be honest) this video is helping me, and will help me get a better understanding of unity physics system. you are too kind. Thanks man. i mean it.
Thanks. The exact kinds of tips I was looking for!
Just realized that I never left a comment on here, anyways, this video is amazing! Everything is explained very well and the visuals really helped to explain the code. Thank you.
Thanks so much! Happy it helped you out
This was great, really helps me a lot this is exactly what i needed. Thank You and keep it up :)
This is really helpfull! You explain this really well and its really easy to follow
Great video. It is easy to make a platformer. But a good player controller is so important for a really good game
fantastic video man!
Thanks so much :D
bro has changed the industry without noticing
I finally caved and decided to just use your movement tutorial, I tried for at least 8 to get and use my own movement system through the power of knowing a highschool amount of math and physics, this one works so much better lmao, at least I tried, good work with yours and thanks
Thank you so much for this video, man. It had so much info I've never considered, keep it up! :D
You're amazing!! Thank you for this, definitely subscribed ^^
Really well explained. Thanks, have subscribed and will definitely check out your future tutorials.
Thanks, glad it was helpful : D
Wow bro, really well covered.
This is so awesome! I've been looking for a way to create a 2D platform character controller that works with Physics for a long time but just couldn't seem to find any good tutorials or examples online. I downloaded your project and was so happy at how clean and tidy the code and the scene are! Thank you so much for the amount of work you put into this!
Have you thought about creating a step-by-step tutorial on how you created the code for the playerMovementImproved script?
Thanks so much! I probably won't make a step by step tutorial, but if you have any questions about the code, feel free to ask me anything here :D
@@DawnosaurDev Thank you!
Awesome analysis, thanks. 🙂
GREAT content man! Will sub for sure :)
this is the most helpful video i have ever found. Thank you ! :>
thank you so much. That will help my game much less boring
Hey man, this video is amazing! Thank you for doing it! Specially for making the source code available. You are a beast! 👊🏻
Good job dude!
Thanks!
This helps a lot