KinematicBody2D stucks when falling precisely on the edge of a wall

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By max.marauder

I’m using move_and_slide(), and in any other cases it works fine, including detection of the floor and walls.
However, if it happens so that the body falls right on the edge of a wall, like shown on the following picture:

![1]
it stucks like that until moved in some direction.
I tried to print is_on_floor() and is_on_wall() values while in such state, and found that they are constantly changing like this:

wall=false, 
floor=false
wall=true, 
floor=false
wall=false, 
floor=true
wall=false, 
floor=false
wall=true, 
floor=false
wall=false```

which looks like it can't decide - whether it's on the floor or on a wall.
If I change body's position by at least 0.01 left or right, then it starts working fine: the body just either lands on the platform, or keeps falling further down.

Any suggestions?

  [1]: https://i.imgur.com/Ak301HB.png
:bust_in_silhouette: Reply From: RakuNana

Change your collision-shape on the player to capsule. This can be found in the inspector for the collisionshape2D. This will smooth out your collisions so you no longer get stuck on the edges :slight_smile:

sorry I pressed comment instead of answer :stuck_out_tongue: