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

RigidBody2D tunnels CollisionShape2D and bounces back with even greater momentum #36294

Open
Tracked by #45334
udit opened this issue Feb 17, 2020 · 3 comments
Open
Tracked by #45334

Comments

@udit
Copy link

udit commented Feb 17, 2020

Godot version:
3.2

OS/device including version:
Windows 10

Issue description:
When a RigidBody2D with very small mass (e.g. 0.1) is connected with a PinJoint2D to another RigidBody2D with a larger mass like (e.g. 100), the heavier body pushes the smaller mass through the CollisionShape2D of another object that it is collides with and bounces back with even greater momentum. This effect diminishes as you keep increasing the mass of the lighter body.

RigidBody2D should not pass through CollisionShape2D of another object and should not bounce back with a greater momentum than before collision.

Minimal reproduction project:
CollisionBug.zip

@Calinou
Copy link
Member

Calinou commented Feb 17, 2020

The tunneling issue is being tracked in #9071.

@udit
Copy link
Author

udit commented Feb 17, 2020

I skimmed through #9071 and I may be wrong but it seems the issue here is a bit different. The RigidBody2D doesn't completely miss the collision. In fact, it does detect the collision but partially overlaps with the CollisionShape2D of another body and then bounces back as seen in the above GIF (or in the minimal reproduction project).

If I increase the mass of the smaller RigidBody2D to a significantly bigger value like 10, then it doesn't overlap with the collision even though it would be falling down at the same speed as before.

@Xrayez
Copy link
Contributor

Xrayez commented Sep 23, 2021

The RigidBody2D doesn't completely miss the collision. In fact, it does detect the collision but partially overlaps with the CollisionShape2D of another body and then bounces back

Yeah, but due to static nature of collision detection, it can only check if those shapes are colliding at the current frame. Since simulation is proceeded with fixed physics step, in most cases penetration will occur, so it needs to be corrected. And this correction may introduce momentum to the system, I suppose. Therefore, #9071 could completely prevent penetration from occurring in the first place.

See also my hypothesis at #52550 (comment).

By the way, setting softness of the pin joint to 0.1 helps those bodies to stay grounded.

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

3 participants