MAN you are the greatest teacher for this smh i went through at least FIVE youtubers trying to explain animation transition and they were horrible at it i see. i kept being left without a clear great answer for a week! Anyway this is my first month starting Unity and trying my hand at a 2D platformer and transitioning and getting my sprite to turn around was the hardest damn thing to pull off. i have to save and download your video.. its the best. thanks for breaking this down. i finally got it right
Dude, whoever you are, you are a fucking blessing let me tell you. Was gonna check your jumping code only, and thought to myself "I already know the movement part", but after checking this, the stuff you write seems super simple and understandable, yet complex on a different level in terms of game mechanics. You really taught me a lot in a subject that I thought I knew well. Hope you get the subs number you deserve soon.
Really enjoy these videos. I make systems of my game most of the time. I am really bad at how to make things look good, you helped me a lot of times to recreate something from older games and I seriously want to thank you for it. I agree, you are definitely underrated. Great presentation, consistent flow of explanation and short videos on single topic.
This is just perfect man! You are one of the few unity youtubers who don't just copy stuff and have no clue what they are talkin about! U implemented everything in an unique way with perfect explanation! I've watched a lot of these tutorials lately and this is the best.
If someone's still watching this, the code has an error at this line of code: "Mathf.Abs(direction.x) < 0.4f" The reason for this is that we use "GetAxisRaw()" for getting Input parameters and that function returns either -1, 0 or 1 so it will never be ranging between those values. To fix this, you can use "(Mathf.Abs(direction.x) > 0f && changingDirections == true)" instead. Hope it helps!.
I think that "Mathf.Abs(direction.x) < 0.4f" check is a little mistake. The author uses GetAxisRaw() for getting Input parameters and the function returns either -1, 0 or 1 and will never be ranging between those values.
Agreed. When working with Tilemap, using a CompositeCollider in addition will solve issues that arise from your character colliding with the edge where two tiles meet.
I haven't learned how to use composite colliders yet, and I can't say I know what's better in terms of runtime or efficiency and such, but I've found that adding a physics material to the edge collider has effectively solved this problem for me too :)
If you click on your tiles and your collider is defined by a bunch of boxes, you should add a composite collider as well which will also include a Rigidbody 2D, just set that to Static and it shouldn’t be doing what’s happening at 7:10
Agreed. When working with Tilemap, using a CompositeCollider in addition will solve issues that arise from your character colliding with the edge where two tiles meet.
Why did you put the CharacterController script on the top level player game object in the first video but in this video it's not there, just Rigidbody 2D and the Player script?
Hi, thank you very much for the free learning resources, it's really helpful when starting out. I wanted to ask you, why you use an edge collider instead of a box collider? To me they seem to be pretty much the same thing.
Im getting an error and im not able to move. the error is: ArgumentException: Input Axis Verticle is not setup. To change the input settings use: Edit -> Settings -> Input PlayerCharacter.Update () (at Assets/Scripts/PlayerCharacter.cs:44) cs:44: direction = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Verticle")); Im stumped, becuase ive checked my input settings over and over in unity and everything is set
I need help. When I quickly double tap the button associated with the direction I am facing, I can't move in whatever direction I was facing. Any idea on how to fix this?
ahh hey, I have an issue that my players edge collider stucks to the edges of my tile map collider if I use a composite collider for tile map then the edge collider doesn't work is there any way to solve this
probably abit late but its got to do with how you setup the animations. watch some videos on transitions and you will understand. to give you the gist of it, disabling exit time and editing the transition time to lower values makes the transitioning between animations more fluid. i recommend watching blackthornprods video on animation to get all the details but I'm sure theres many other RUclipsrs who can give you the same info.
don't use rigidbody2D.addforce if you use slopes... either write your own physics... or just use rigidbody2D.velocity = new Vector2(moveSpeed*direction.x,rigidbody2D.velocity.y)
I had to get rid of this line of code cause it kept giving me an error saying that string doesnt exist when it clearly did exist. and it seems this line of code didnt do anything anyways animator.SetFloat("horizontal", Mathf.Abs(rb.velocity.x));
When making the transitions between animation states at the end of the last video, you skip showing the transitions for the falling animations, you only show fall -> idle im having trouble getting it to work
Sure, if you don’t want to use any physics or collision elements in your game, but most platformers do. I try to avoid using addForce as much as possible but if you want a true to feel character controller, it’s sort of unavoidable.
@ MueqaTrae It appears as though he is using `rb.AddForce` here to avoid having to implement his own movement acceleration. Since `rb.AddForce` adds to the character's existing velocity every frame, it effectively gives him the acceleration he desires for a Mario like game feel. However, I also noticed that he is mixing the use of `rb.AddForce` and `rb.velocity` in his code.
@PressStart Is there a specific reason you decided against defining an acceleration constant and integrating the movement yourself? (re "if you want a true to feel character controller, [using AddForce is] sort of unavoidable") ``` // Acceleration per physics step [SerializeField] private float moveAcceleration; private void moveCharacter() { rb.velocity = new Vector2( rb.velocity.x + ( direction * moveAcceleration * maxSpeed * Time.fixedDeltaTime ), rb.velocity.y ); // (...) } ```
You are definitely one of the most underated unity youtubers
Thanks man!
@@pressstart6864 Return with the videos, pls
Your videos help a lot, because you explain the logic, no just the code itself.
yeah i co sign that majorly
These series are so good! Quality is clearly a top priority in this channel
I'm glad you're enjoying the series. And yes quality is most important to me!
MAN you are the greatest teacher for this smh i went through at least FIVE youtubers trying to explain animation transition and they were horrible at it i see. i kept being left without a clear great answer for a week! Anyway this is my first month starting Unity and trying my hand at a 2D platformer and transitioning and getting my sprite to turn around was the hardest damn thing to pull off. i have to save and download your video.. its the best. thanks for breaking this down. i finally got it right
Anybody who wants to create a platformer needs to watch this. Thank you so much
This is the only video that explains how to move an object in a constant velocity using .AddForce instead of .velocity
Thank you so much.
Dude, whoever you are, you are a fucking blessing let me tell you. Was gonna check your jumping code only, and thought to myself "I already know the movement part", but after checking this, the stuff you write seems super simple and understandable, yet complex on a different level in terms of game mechanics. You really taught me a lot in a subject that I thought I knew well. Hope you get the subs number you deserve soon.
Really enjoy these videos. I make systems of my game most of the time. I am really bad at how to make things look good, you helped me a lot of times to recreate something from older games and I seriously want to thank you for it. I agree, you are definitely underrated. Great presentation, consistent flow of explanation and short videos on single topic.
I really appreciate the kind words and I'm glad I could help you in your game dev journey.
This is just perfect man! You are one of the few unity youtubers who don't just copy stuff and have no clue what they are talkin about! U implemented everything in an unique way with perfect explanation! I've watched a lot of these tutorials lately and this is the best.
I can see this channel blowing up in a month or two, you do great work.
Let’s hope so mate
Thit is amazing tutorial, your channel is what i was searcing for ages
Great video man, clear and not too long, keep on this path! i'm waiting the jumping tutorial!
Thanks for the feedback. Working on the jumping video today, hoping to have it done for October 15th, release.
I love your controller script so much! I altered it to work with the new input system and it worked perfectly
If someone's still watching this, the code has an error at this line of code: "Mathf.Abs(direction.x) < 0.4f"
The reason for this is that we use "GetAxisRaw()" for getting Input parameters and that function returns either -1, 0 or 1 so it will never be ranging between those values.
To fix this, you can use "(Mathf.Abs(direction.x) > 0f && changingDirections == true)" instead.
Hope it helps!.
Thank you, I was facing the same issue.
Best of all tutorial ive seen, pls countinue doing videos! hug from Argentina!
Whoa man! Great tutorial! I got smooth movement because of you!
Nice, thanks for your awesome tutorial!
Very helpful :D
Yes they're nice^^
I think that "Mathf.Abs(direction.x) < 0.4f" check is a little mistake. The author uses GetAxisRaw() for getting Input parameters and the function returns either -1, 0 or 1 and will never be ranging between those values.
You can resolve the tile collision issue by using a composite collider. Just remember to set the tilemap's rigid body to static.
Hmmm
Agreed. When working with Tilemap, using a CompositeCollider in addition will solve issues that arise from your character colliding with the edge where two tiles meet.
I haven't learned how to use composite colliders yet, and I can't say I know what's better in terms of runtime or efficiency and such, but I've found that adding a physics material to the edge collider has effectively solved this problem for me too :)
If you click on your tiles and your collider is defined by a bunch of boxes, you should add a composite collider as well which will also include a Rigidbody 2D, just set that to Static and it shouldn’t be doing what’s happening at 7:10
Agreed. When working with Tilemap, using a CompositeCollider in addition will solve issues that arise from your character colliding with the edge where two tiles meet.
Phenomenal video! I was just about to ask a question and then I realized my own error haha.
Very nice stuff! Keep up the good work
thank you!
Awesome trick with that rotate 180
this is soooooo good and simple!
keep making video one day you will get 1 m subs...u r one of the best..like to who think i am right
Why did you put the CharacterController script on the top level player game object in the first video but in this video it's not there, just Rigidbody 2D and the Player script?
What amazing tutorial!
Keep this videos quality :)
why in this video you took out the vertical parameter and the fall animation?
Your work is awesome man. Keep going!!!
Keep watching!!! You’re awesome!
Great overall videos! Subbed and notification bell ringed! Looking forward for more content :)
Look at this dood. Thanks!
Really helpful tutorial! Subbed!!!
really great video. helped a ton
is there a way to change how fast the player accelerates?
Hi, thank you very much for the free learning resources, it's really helpful when starting out. I wanted to ask you, why you use an edge collider instead of a box collider? To me they seem to be pretty much the same thing.
Now how do I do this in 4 directions? I'm having trouble with the New Input System.
Excelente..!!
Im getting an error and im not able to move.
the error is:
ArgumentException: Input Axis Verticle is not setup.
To change the input settings use: Edit -> Settings -> Input
PlayerCharacter.Update () (at Assets/Scripts/PlayerCharacter.cs:44)
cs:44:
direction = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Verticle"));
Im stumped, becuase ive checked my input settings over and over in unity and everything is set
ah.... I spelt Vertical wrong lol
I need help. When I quickly double tap the button associated with the direction I am facing, I can't move in whatever direction I was facing. Any idea on how to fix this?
in my case the rigidbody doesn't change the linear drag. does anyone know how i can fix this?
ahh hey, I have an issue that my players edge collider stucks to the edges of my tile map collider if I use a composite collider for tile map then the edge collider doesn't work is there any way to solve this
underrated, although seems like a lot of code for that smoothness
Why don't you use velocity instead of addforce?
Can I use the same code for the Mario game created in 3D?
i have a problem when my character changes directions, the idle animation is called for a sprite when is already moving in the other direction.
probably abit late but its got to do with how you setup the animations. watch some videos on transitions and you will understand. to give you the gist of it, disabling exit time and editing the transition time to lower values makes the transitioning between animations more fluid. i recommend watching blackthornprods video on animation to get all the details but I'm sure theres many other RUclipsrs who can give you the same info.
amazing
when my character goes to run left, he doesn't turn to face left why
thank you so much
Well, is it not good to use for 3d player object?
I'm having trouble with getting this to handle slopes, my characters little legs are just too weak!
don't use rigidbody2D.addforce if you use slopes... either write your own physics... or just use
rigidbody2D.velocity = new Vector2(moveSpeed*direction.x,rigidbody2D.velocity.y)
How do you do this in 3D?
I had to get rid of this line of code cause it kept giving me an error saying that string doesnt exist when it clearly did exist. and it seems this line of code didnt do anything anyways
animator.SetFloat("horizontal", Mathf.Abs(rb.velocity.x));
When making the transitions between animation states at the end of the last video, you skip showing the transitions for the falling animations, you only show fall -> idle
im having trouble getting it to work
if you don't use AddForce for the player movement you can avoid all those headaches
Sure, if you don’t want to use any physics or collision elements in your game, but most platformers do. I try to avoid using addForce as much as possible but if you want a true to feel character controller, it’s sort of unavoidable.
@
MueqaTrae It appears as though he is using `rb.AddForce` here to avoid having to implement his own movement acceleration. Since `rb.AddForce` adds to the character's existing velocity every frame, it effectively gives him the acceleration he desires for a Mario like game feel. However, I also noticed that he is mixing the use of `rb.AddForce` and `rb.velocity` in his code.
@PressStart Is there a specific reason you decided against defining an acceleration constant and integrating the movement yourself? (re "if you want a true to feel character controller, [using AddForce is] sort of unavoidable")
```
// Acceleration per physics step
[SerializeField] private float moveAcceleration;
private void moveCharacter()
{
rb.velocity = new Vector2(
rb.velocity.x + (
direction * moveAcceleration * maxSpeed * Time.fixedDeltaTime
),
rb.velocity.y
);
// (...)
}
```
why did you use rb.Addforce instead of rb.MoveCharacter?
Because he wanted acceleration
What about transform.position lol
please come back!
I love you
1000th like
If there is one thing I'll take away from this is to use the "animator windor"
great video...but damn if your coding style doesnt frustrate the hell out of me lol. most unpretty... like bruh Capitalize your functions
well, whole day wasted. start from scratch tomorrow
why do you have to start from scratch lmao. Imagine starting over every time something doesn't work out