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

Collision Algorithm of RigidBody2D #39493

Closed
liryu1973 opened this issue Jun 13, 2020 · 10 comments
Closed

Collision Algorithm of RigidBody2D #39493

liryu1973 opened this issue Jun 13, 2020 · 10 comments

Comments

@liryu1973
Copy link

liryu1973 commented Jun 13, 2020

Godot version:3.2.1

OS/device including version:
Windows10, gtx1050, GLES3

Issue description:
See the gif movie first.
During the second collision, RigidBody2D has a significant overlap.
Essentially, overlap in a collision should not be drawn.
If an overlap is detected, you can push it back and then draw it so that it won't be drawn on the screen at all.
Perhaps the order of the process is reversed?
If collision processing is performed after drawing, the pushback will be drawn in the next frame, causing overlap in the current frame.

collision

RB2D_Test.zip

Postscript:
Changing Physics fps or Continuous Cd will not improve the overlap.

@rsubtil
Copy link
Contributor

rsubtil commented Jun 13, 2020

In my setup (Linux, GeForce MX110, GLES3), only the first collision shows this "bounce" behaviour; after that, no matter how fast I hit, it doesn't overlap.

@Calinou
Copy link
Member

Calinou commented Jun 13, 2020

I think this issue is a duplicate of another one, but I can't find the other issue in question right now.

@liryu1973
Copy link
Author

liryu1973 commented Jun 13, 2020

In my setup (Linux, GeForce MX110, GLES3), only the first collision shows this "bounce" behaviour; after that, no matter how fast I hit, it doesn't overlap.

I thought so too at first.
It seems that overlap is less likely to occur after the second time than the first time.
But that doesn't mean it doesn't happen at all.
If you change the y position and make it collide again The overlap happens again.
The second time in a gif movie is a fluke. In my environment, it happens when it happens a number of times.

I've heard that Godot is currently undergoing a major refactoring.
Please fix this together.

@ghost
Copy link

ghost commented Jun 13, 2020

RigidBody2Ds do have long standing issues with interpenetration during the frame, and I've never known the CCD from the node property to alleviate this or even work at high speed. When it passes into other bodies is also inconsistent.

I once used them for characters, and most the time jumping and landing was fine, but every dozen landings the character might dig into the surface and halt their velocity.

@Zireael07
Copy link
Contributor

CCD has been broken for several years :(

@abhinav4987
Copy link

CCD has been broken for several years :(

so is it open?

@Zireael07
Copy link
Contributor

Yes, there's an open issue somewhere about it.

@ghost
Copy link

ghost commented Jul 3, 2020

Possibly related: #34215

@Exxion
Copy link
Contributor

Exxion commented Dec 18, 2020

This is because, by default, the objects are only moved each frame 0.3 times the distance it would take to completely separate them. I'm guessing this is to make collisions involving multiple objects more stable, but I don't really know. You can change the custom solver bias variable on the collision shapes involved to change this behavior, including setting it all the way to 1 to make collisions perfectly rigid. Again, this probably causes some instability, though.

@Calinou
Copy link
Member

Calinou commented Dec 18, 2020

Duplicate of #34215 – the underlying cause is the same.

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

6 participants