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

The way KinematicBody pushes itself back after multiple collisions is flawed #41289

Closed
Pixificial opened this issue Aug 15, 2020 · 1 comment
Closed

Comments

@Pixificial
Copy link

Pixificial commented Aug 15, 2020

Godot version:
3.2.2.stable

Issue description:
The KinematicBody node does not correctly push itself back when it is colliding with multiple that push it in an axis.
In the source code, at the 995th line, you can see that it pushes itself back by each collider according to said collider.

if (collided) {
	found_collision = true;

	colliders.push_back(collision);
	...
}

Although this works with multiple colliders that push the KinematicBody in a single axis by itself, if there are multiple colliders that push in a single axis, that will cause the KinematicBody to land on a wrong position after the collisions.

image

Steps to reproduce:

  1. Create a KinematicBody.
  2. Create multiple StaticBodys on the same position, preferably a lot.
  3. Attach a script to the KinematicBody that will allow you to move the KinematicBody to the stacked StaticBodys.
  4. Notice how the KinematicBody is repositioned too far away from the StaticBodys, since each of the StaticBodys push the KinematicBody the same amount that would position the KinematicBody correctly by itself.

Minimal reproduction project:

KinematicBody Collision Flaw.zip
(Move with left & right arrow keys.)

PS: This is my first time "posting" anything on GitHub, please let me know if something about the post is off.

@madmiraal
Copy link
Contributor

Duplicate of #35780, fixed with #35945.

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

No branches or pull requests

2 participants