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 during collisions over-correct when trying to get unstuck with many colliding shapes #38993

Closed
Rhathe opened this issue May 23, 2020 · 1 comment
Labels

Comments

@Rhathe
Copy link
Contributor

Rhathe commented May 23, 2020

Godot version: 3.2.1

OS/device including version: Win10

Issue description:

When a KinematicBody2D collides with a group of bodies of a large enough number, its recovery step in trying to get unstuck can lead to a too large of a recovery motion where its original velocity will not even lead to it colliding in that step. This results in visually apparent jittering and non-continuous collisions when using move_and_slide to slide along a row of bodies, such as a tilemap. This is due to the line in

recover_motion += (b - a) * 0.4;
and similar other lines, where the magic number 0.4 is used to help scale recovery motion. When cbk.amount is large, which is proportional to the number of shapes collided with, the recovery motion also becomes overly large. This can be solved here and in other places by dividing by cbk.amount instead of multiplying by 0.4, as seen in #36280, but can be its own pull request since it's not unique to one way collisions and probably also applies to 3D.

Steps to reproduce:

Create a kinematicbody2d long enough to collide with multiple other bodies, see that it over-corrects and leads to jittering of the kinematicbody2d.

Minimal reproduction project:

test tilemap collision.zip

@madmiraal
Copy link
Contributor

Duplicate of #35780.

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

3 participants