ULTIMATE 2D Platformer Controller for Unity

  Рет қаралды 18,435

Sasquatch B Studios

Sasquatch B Studios

Күн бұрын

Пікірлер: 48
@Elenyen
@Elenyen 7 күн бұрын
Your code is perfect example of clean code 🔥
@Pandaluf
@Pandaluf 7 ай бұрын
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 3 ай бұрын
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е 6 ай бұрын
Dude, you have no idea how much you helped me. Thank you very much! We need more of these videos! :)
@RakuraiBlader
@RakuraiBlader 2 ай бұрын
Since you got it, do you know what "UnityEngine.InputSystem" is? I'm getting several problems because Unity doesn't recognize the type/namespace.
@SadTown99
@SadTown99 9 күн бұрын
Geeeeeez 😵‍💫 What a freakin’ gold mine of a channel this is… Thank you dude ‼️
@Firestone-Games
@Firestone-Games 7 ай бұрын
Awesome Tutorial, as always.
@libberator5891
@libberator5891 7 ай бұрын
18:12 OnDrawGizmos isn't called in a Build, so turning it off or leaving it on won't make a difference.
@beatrageGameSalad
@beatrageGameSalad 7 ай бұрын
Nice tutorial!
@Fracturedgraphic
@Fracturedgraphic 4 ай бұрын
Great walkthrough!
@siimmae4009
@siimmae4009 3 ай бұрын
really great tutorial. thank you!
@乾淨核能
@乾淨核能 2 ай бұрын
wow a god sent video, thank you!
@cadafinn
@cadafinn 5 ай бұрын
tus videos me ayudan a seguir adelante, hay muchas cosas que debo aprender de unity, Me encanta personalizar la jugabilidad del personaje.
@fireraccoon_
@fireraccoon_ 7 ай бұрын
Oh. That is super cool and nice!
@NameThinkerGames
@NameThinkerGames 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 7 ай бұрын
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.
@maxiecoates8108
@maxiecoates8108 2 ай бұрын
@@Razofgal Simple solution which actually introduces loads of other problem, you now have a massive pain when dealing with anything that moves which imo is an essential part of any 2d platformer. For me this controller isnt flexible enough to support the core components of 2d platformer.
@degrees97
@degrees97 Ай бұрын
Great character controller I love the feel of it. However it doesn't handle slopes well from my experience. I did some changes while learning from your video but I don't think they caused the behaviour that happens, when you go down a slope the player basically hops down. I already tried to change the feet collider to a capsule and created a new variable "isOnSlope" that checks the angle of the normal that the "isGrounded" raycast hits but I'm having trouble finding the piece of logic where I could use it to smoothly handle slopes. I would greatly appreciate your input and am sure this would be a great addition to an already amazing character controller :)
@douick
@douick 5 ай бұрын
thanks you for your awesome tutorial, but how do you handle inclined plane like stairs ?
@erikmarchini3274
@erikmarchini3274 8 күн бұрын
I wrote "Run" in the Code, it didn't work, "Sprint" did, it took me 1 hour to resolve the issue... The "DebugShowIsGroundedBox" thing is just impossible to figure out right now...
@blasterxt9
@blasterxt9 3 ай бұрын
Buddy explains the new input system of unity
@soufianebenamer7585
@soufianebenamer7585 7 ай бұрын
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 .
@midniteoilsoftware
@midniteoilsoftware 7 ай бұрын
Fantastic!
@veerajukuri
@veerajukuri 7 ай бұрын
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.
@AnEmortalKid
@AnEmortalKid 7 ай бұрын
This reminds me of the plarformer toolkit by GMTK
@job1481
@job1481 4 ай бұрын
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?
@Dragon_Master
@Dragon_Master Ай бұрын
Hello so I'm trying to use this to test if I want it for my game and for some reason, I can just jump infinitely in the air why? Also Any suggestions on other game tutorials for my game. This is the first time i'll be making my own game and I don't really know what I'm doing lol. Oh also there was a weird thing where my Update, Awake, and FixedUpdate Functions were like making seem as though they weren't premade functions. Cause in his video those functions were in blue text but mine were in yellow. And when my functions are in yellow it means it's a function I have to/create so maybe it's that IDK.
@nike-c8l
@nike-c8l 4 күн бұрын
I double checked the code, but I didn't press any buttons and the character kept jumping. Who knows what's going on.
@dynamogames.
@dynamogames. 4 ай бұрын
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. 4 ай бұрын
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.
@Knife8
@Knife8 5 ай бұрын
can u upload the code?
@princessbaeex
@princessbaeex Ай бұрын
I get a error for the movement stats that I cannot convert from double to float what does that even mean🤧
@benzinaria
@benzinaria 8 күн бұрын
Make sure you use Mathf and NOT Math in line Gravity = -(2f * JumpHeight) / Mathf.Pow(TimeTillJumpApex, 2f);
@werter7779
@werter7779 3 ай бұрын
i guess.. i will can not add an other platformer movement mechanics after all by myself😅
@eva-nf9fl
@eva-nf9fl 4 ай бұрын
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.
@benzinaria
@benzinaria 8 күн бұрын
Make sure you freeze the z axis on the rigidBody2D
@tensura-x74
@tensura-x74 Ай бұрын
I cant move how do i fix this someone help
@restingsox9022
@restingsox9022 3 ай бұрын
How to do state machine?
@josegarcia755
@josegarcia755 6 ай бұрын
this did not work for me. Not sure what i did wrong.
@tensura-x74
@tensura-x74 Ай бұрын
Same
@capilover1023
@capilover1023 3 ай бұрын
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
@alendugalic6922
@alendugalic6922 Ай бұрын
I had this as well until i played back and noticed something he doesn't talk about. In your input manager that's in the scene you have to make sure it has a player Input component and your Input actions attached. Hope this fixes the problem :)...also make sure your naming matches your input actions naming
@tensura-x74
@tensura-x74 Ай бұрын
​@alendugalic6922 can u pls explain exactly what to do im haveing this problem but I'm a beginner so I didn't fully understand what u said
@tensura-x74
@tensura-x74 Ай бұрын
had the same issue
@StressedProgrammer
@StressedProgrammer 7 ай бұрын
How can i try this?
@sandman76_
@sandman76_ 7 ай бұрын
epic
@CoconutButter45
@CoconutButter45 7 ай бұрын
First
Create a SEQUENCE System for a list of Commands (Unity Tutorial)
11:28
Sasquatch B Studios
Рет қаралды 4,6 М.
Why Does Celeste Feel So Good to Play?
17:34
Game Maker's Toolkit
Рет қаралды 2,7 МЛН
Ful Video ☝🏻☝🏻☝🏻
1:01
Arkeolog
Рет қаралды 14 МЛН
Air Sigma Girl #sigma
0:32
Jin and Hattie
Рет қаралды 45 МЛН
УЛИЧНЫЕ МУЗЫКАНТЫ В СОЧИ 🤘🏻
0:33
РОК ЗАВОД
Рет қаралды 7 МЛН
ULTIMATE 2D Platformer Controller for Unity (Part 2)
27:27
Sasquatch B Studios
Рет қаралды 4,3 М.
CLEAN Game Architecture with ScriptableObjects | Unity Tutorial
13:12
Sasquatch B Studios
Рет қаралды 21 М.
Idle, Run and Jump Animations - Platformer Unity 2D
10:13
Game Code Library
Рет қаралды 68 М.
What 1 Full Year of Indie Game Development Looks Like!
4:50
Plasma Studios Dev
Рет қаралды 12 М.
How to Make Games when you SUCK at Art
8:13
Sasquatch B Studios
Рет қаралды 12 М.
Improve your Platformer’s Jump (and Wall Jump) | Unity
8:12
Dawnosaur
Рет қаралды 133 М.
The ULTIMATE 2D Character CONTROLLER in UNITY
15:21
Shinjingi
Рет қаралды 72 М.
How I made an Excellent Platformer
8:25
GoldenEvolution
Рет қаралды 297 М.
The MOST WANTED Unity Feature is FINALLY here!
12:15
Code Monkey
Рет қаралды 58 М.
Ful Video ☝🏻☝🏻☝🏻
1:01
Arkeolog
Рет қаралды 14 МЛН