0
Answered

2d platform tutorial: player won't fall if it keeps walking into a wall while in the air

Federico Meini 3 years ago updated 3 years ago 4

Hi everyone,

I have followed the official 2D platformer tutorial and then changed the tilemap a little bit and added some walls.

I then realized that if you jump against  a wall and then keep pressing for example the right arrow (if the wall is on the right) you keep setting horizontal velocity to the player and since it is pressing against a wall it will never fall down back to the ground (unless you stop moving it against the wall).

I was wondering if there is a simple solution to this problem. Thanks a lot!

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
GOOD, I'M SATISFIED
Satisfaction mark by Federico Meini 3 years ago

can you share your graph?

Answered

Interesting issue. If I remember correctly, the player controller has a physics material with zero friction, so this shouldn't happen. It's important to check that your velocity setting graph does respect the existing Y value of the rigidbody, otherwise this kind of issue can arise.

You are right, I forgot to set the "No Friction" material to my player object.
What a silly mistake!

As usual thanks a lot for your help!

UPDATE:

Solved! I forgot to set the "No friction" material to my player object.


Hey guys, thanks for the help!

Since my project is now very different from the original tutorial and it's hard to understand why this happens, I decided to start from scratch with the tutorial again in a new project and see if I can replicate the issue.

I will do that in the next days and report back, thanks for now!