Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KinematicBody2D gets stuck when the corner of its rectangular collision shape collides precisely with the corner of another bodies. #38367

Closed
CritCorsac opened this issue Apr 30, 2020 · 1 comment
Labels

Comments

@CritCorsac
Copy link

Godot version:
3.2.1 and 3.2.2 Beta 1

Issue description:
When using move_and_slide() on a KinematicBody2D that has a rectangular collision shape, if the corner of its collision shape happens to collide with the corner of another body with a rectangular collision shape, the KinematicBody2D will get stuck and return a high get_slide_count().

Here’s a GIF from the attached minimal reproduction project.
cornerBugCompressed

In the GIF, the box on the right has been aligned so that its left side has the same x position as the floors right side. This perfect alignment is what causes the bug.
The left boxes right side is not perfectly aligned with the floors left side. It has been placed a single pixel more so to the right, allowing it to avoid the bug.

From what I’ve discovered, changing the safe margin of the falling bodies to very high or very low amounts prevents this bug from occurring but due to the other collision problems that occur with very high or very low safe margins it is not a viable solution.

In my experience this bug is more prevalent in low resolution pixel platforming games. It’s a rare occurrence but when it crops up it can cause the character to get stuck in a permanent falling state.

Minimal reproduction project:
Corner Bug Example.zip

@KoBeWi
Copy link
Member

KoBeWi commented Apr 30, 2020

Duplicate of #23140
AFAIK the safe margins will be removed on physics rework coming in Godot 4.0 or 4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants