0 votes

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:

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:

floor=true 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?

in Engine by (32 points)

1 Answer

0 votes

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 :)

sorry I pressed comment instead of answer :p

by (54 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.