About 'Prevent Wall Jump'!

In this video (objectives)…

  1. Add physics material to stop sticking to wall.
  2. Add additional collider to represent player's feet.
  3. Only allow feet to determine if player is touching the ground.

After watching (learning outcomes)…

Prevent funky wall behaviour.

(Unique Video Reference: 21_TV_CUD)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!


Hi, when i add the zeroFriction material to my players capsule collider the player starts sliding on the floor. I can’t wrap my head around on how no friction on the player only would affect the sides of the characters collider. It fixed the stuck on wall problem but now it’s like my player is an ice skater…
Been searching the net for an hour now and can’t find any solution, where did i go wrong?

Love the course btw, been studying 8 days in a row now.


Are you using the same code as we are for moving your player (within the run method) or have you using your own code for this?

Got a question - I ignored you near the start of the course (sorry!) and did a Box Collider 2D instead of a Capsule Collider 2D for the player mask, basically just down to personal preference. Worked fine until now, but in this lesson you say to add the feet as a Box Collider 2D too.

I guess my question is - is there a way to differentiate in the script between two of the same type of components on an object, or are my only options to either use separate colliders or use a child object for the feet (or perhaps another way)?

Using different collider types is just an easy way for us to differentiate. You can do it other ways. Having feet as a child is a good way to do this.

Hi! First of all: thanks for the great course, it’s fun to learn and I really feel to make a lot of progress.

I encounter a bug which I just can not get rid of, no matter what I try:
As soon as I add the box collider to my Player Object, when I start to play the Game, random collisions occur with seemingly invisible objects. invisiblecollision

I’ve added a picture to show what I have discovered: Just like in your version of the Game, mine had these tiny “gaps” between the tiles. (I turned the background color of my camera to pink to make it more visible). After turning off anti aliasing, the gaps seemed to have disappeared.

So back to the collisions: When I collide with one of these invisible objects and then zoom in the camera, sometimes these gaps become visible again and it seems like I am colliding with them (and cannot move further). My theory is that this is due to the fact that there is a gap between the tiles, there is no collision detected between my “feet” and the foreground layer. I tried everything to get rid of this, but the only thing that helps is removing the box collider (which makes it impossible to finish the lecture).

Sorry for the long read and pelase excuse any grammar or spelling mistakes, english isn’t my native language.

Thanks in advance, best,


Hmmm, this is a guess, but double check your physics layer matrix to make sure you aren’t colliding with the background.

Hello! Quick question, if I wanted to add an animation to jumping, and wanted that animation to start when the jump is initiated (of course, hehe) and then stop when landing, what would be the easiest way to do so, using the infrastructure of the current project?

Thank you in advance!

Within your animator controller, create a state which is the jump animation. Trigger it when you push the jump button and then you can trigger a return to the run / climb state when the feet collide with the ground.

1 Like

I am having an issue with this one, after adding the box collider for the feet my player gets stuck just passed the ground level and I am unable to jump. Most of the time I start normally and as I jump and move around I get stuck but I can still move left and right but nothing else. When I look at the collider during gameplay I see the collider below the ground level and I do not know how to fix this. I am using all the same code. Thanks

As you can see the box collision for the feet is passed the ground collider. I can move left and right but thats it. I get stuck on that ledge and can’t figure out what is causing this. The code is all the same from the tutorial. Any advice would be great.

Hi Julian,

I was struggling with the same problem.
I noticed that it only happens when the players has falls down from a specific hight and is probably related to the speed.
While debugging it frame by frame I noticed that when the player lands, all the colliders are far below the ground.
Without the Box Collider 2D the player was moves up automatically, but with the Box Collider 2D it stops before being above the ground.

I solved that by changing the players “Collision detection” type in Rigidbody 2D from “Discrete” to “Continuous”.


I used Raycast to check instead. There was no need to add new components or collider game objects.

With the method below, true is returned even if there might be a tiny little gap between player and ground. In other words, the player can jump when they are just above the ground, without actually touching it.
I think that’s cool since it creates a hidden mechanic that player can continuously hop back-to-back without exiting jumping state.


    private bool CheckOnGround()
        return Physics2D.Raycast(

After adding the box collider, I noticed a bug when my character drops from a certain height that they become ‘stuck’. They ‘sink’ a bit into the ground, and are unable to jump, but they can move left/right albeit slower than usual. My fix for this was to tick “is trigger” for the box collider. Everything seems to work fine. No double jumping, no wall jumping. And all other collisions seem to be working properly.


When they jump from a higher height, the player gets stuck where he lands. Go through the collider. I can only move left and right.
How can I fix the problem?

Privacy & Terms