Possible problem with isTouchingLayers approach

Let me just say that I haven’t tested this approach yet because I wrote my own code before watching this video. But it seems like using the isTouchingLayers method has a major flaw, it will allow you to jump while touching the side of the ground, which means you can keep jumping to climb any wall.

The way I did it was to use a raycast pointed down from the player that detects if they are on the ground or not.

3 Likes

You’re absolutely right about this. Even holding the run button while against a wall would allow the player to stick there.

Your idea of using a Raycast works perfectly. Thanks.

You can also add a physics2d material to the players RigidBody and set the friction to 0.
That should work as long as there are no slopes i think :grin: