Improve Your Platformer with Forces | Examples in Unity
HTML-код
- Опубликовано: 3 июн 2024
- 🎬Designing a Platformer Jump: • Improve your Platforme...
Want to make your character feel fluid and responsive to control? Use these tips and tricks to improve your platformer in any Engine or Language.
In this video, I'll show YOU how you can make more advanced platformer movement, which is more flexible to your needs as well as feeling fantastic to control. You'll see some examples made in Unity.
🎮Demo: dawnosaur.itch.io/platformer-...
📜Code: github.com/Dawnosaur/platform... (platformer controller & Unity demo)
☕ | Support me (ko-fi.com/dawnosaur)
═══════ 🦖My Stuff ═══════
💬│Discord ( / discord )
→ A community that loves game creation
📰 | Newsletter (dawnosaur.substack.com/)
→ Weekly discussions on game design, creators and stuff by me :)
🎮│My Games (dawnosaur.itch.io/)
→ Mostly small projects made for game jams as well as COSMOS my first commercial release
🎁My Game!
store.steampowered.com/app/12...
═══════ 📚Resources ═══════
Creating a 2D Platformer | • [Unity] Creating a 2D ...
Ultimate 2D Platformer Controller in Unity | • Ultimate 2D Platformer...
Here's some further reading that I've found super interesting:
◽ www.davetech.co.uk/gamedevplat...
◽ / 28582857
◽ info.sonicretro.org/SPG:Charac...
═══════🧪Next Steps ═══════
Many other features found in platformers were excluded from this video due to time, difficulty, etc. Many of these will be added to the code above shortly, however, some may take a bit longer.
So here is a small collection of some other features you could consider adding.
- Changes to acceleration when in the air
- Changes to acceleration when turning
- Dash
- Double Jumps
- Wall Jumps (was having trouble getting these to work without overriding velocity will release code whenever I get something that feels nice, working)
═══════⏰Time Stamps ═══════
0:00 Intro
0:25 Summary
0:45 Run
1:33 Forces
3:19 Friction
3:37 Jump
4:09 Coyote Time
4:36 Jump Cut
5:03 Fall Gravity
5:22 Examples
5:42 Quick Tips
6:15 Outro
6:45 Thanks! - Игры
🎬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)
2:07 the most beautiful 4 lines of code I have seen in my life
Made me smile!
agreed
I was looking for something like this for days. Really well-made video.
This is amazing. Really hope you keep up with these. Great job!
Great video and of a higher quality than a lot of other Unity tutorials I've seen. Looking forward to your next video
This video is so high quality, excellent job! Looking forward to more
Awesome video ! You're teaching so much in such a short amount of time, while still going deep when needed.
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!
had an absolute blast watching through this video for 3 days getting everything just right. Great video
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!
This is perfect. Working on my first game with my son. Our movement is big standard and feels awkward. Thank you so much!
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. :)
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!
This was SO HELPFUL!!!
Thank you and please keep making more tutorials!
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
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
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!
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
Wow, I really like that, I've been looking for this video for a long time
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.
have had alot of probelms with movement fundamentals, thank you so much for this
This is explained so clearly, I couldn’t have done it better myself. Thank you! :D
Glad it was helpful :D
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.
Thank you so much for this video, man. It had so much info I've never considered, keep it up! :D
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.
Very well explained. Glad I found this
Absolute pure jam, thank you for video!
Thank you, this made my platformer feel even better to play!
Absolute S tier video. I was wondering why my movement felt so stiff and floaty and this improved it by sooo much
finally a professional tutorial about unity player movement, thanks!
Great visualization on why the issue happens! Good video.
This is the best Player Controller video I’ve seen. Thank you so much!
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
This is very nice way of using RB but still respecting it's velocity variable by keeping it untouched.
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
Oh god, this video is really good and helpful. Hope you can keep doing this series.
Hey man, this video is amazing! Thank you for doing it! Specially for making the source code available. You are a beast! 👊🏻
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
Thanks. The exact kinds of tips I was looking for!
This was great, really helps me a lot this is exactly what i needed. Thank You and keep it up :)
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
GREAT content man! Will sub for sure :)
Great tutorial format! Loved it! :)
This is exactly what I needed for the platformer game I'm making, inspired by Celeste and Ori. Earned yourself a sub :D
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!
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
I'm from Brazil, and your video is very amazing, I hope it continues.
Very good. ✔
This video is completely insane, just continue what u doing it's amazing :D Gj mate
Thanks a lot :D
Very nice video, very educational and also nice, smooth video animation.
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!
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
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 👀
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
You're amazing!! Thank you for this, definitely subscribed ^^
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
Such a quality video and the amount of content in it, subscribed! :D
Thanks, can't wait to make another!
Please keep making these types of videos they’re very useful 🙏🙏🙏
FINALLY A GOOD VIDEO THAT SHOWS A DIFFERENT WAY TO MOVE, THANKS DUDE
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 👀)
Nice video it really helps a lot and thankyou for the code and examples.
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.
thank you very much for this incredible resource. it takes a lot of effort to make quality content and I am grateful for you providing us this great service. thanks.
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
Really well explained. Thanks, have subscribed and will definitely check out your future tutorials.
Thanks, glad it was helpful : D
Awesome video, great explanation:)
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
Wow bro, really well covered.
Great video! Hope to see your future videos
Самый полезный канал по разработке, который я только находил, божественно! Хочу больше видеоуроков😍
Thanks!
This helps a lot
this is the most helpful video i have ever found. Thank you ! :>
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
Super well made video with a lot of useful information! :)
Thanks a ton!
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.
Really informative and usefull. Easily earned subscribe. Good job.
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!
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!!!!
>:D this was a really good base for 3d first person movement! thank you so much!
Quickly and well explained :D
i just need to understand it now xD
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
thank you so much. That will help my game much less boring
Well done man, super informative
Thanks! Happy it helped
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.
One of the highest Quailty gamedev tutorials i ever seen
HIgh quality for such a small channel
bro jawking good video, i was looking for that for montsh
This is really good! keep going!!!
Thanks a lot :D
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
thanks so much man this helps a lot
Awesome analysis, thanks. 🙂
Thx for the tips, now Im going to try to figure out how to implement it using a Heriarchical State Machine design for my player mechanics... And when I thought I had finished my movement lolol! loved this video, subscribed.
This is a realy cool tutorial. Thanks for it
Really helpful and well made video
Great video. For me - as I need solutions to problems - its perfect. Short, to a point and informative.
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
Thank you for making this! I’m making a 3D platformer and want the controls to be somewhere between Hat in Time and Blue Fire.
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