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

Bizarre, inaccurate force or acceleration applied to 2D rigid body with collision polygon. #47745

Closed
jitspoe opened this issue Apr 9, 2021 · 4 comments

Comments

@jitspoe
Copy link
Contributor

jitspoe commented Apr 9, 2021

Godot version: 3.2.3

OS/device including version: Windows 10, GLES2

Issue description: Really bizarre "force"/acceleration applies to 2D rigid body with a collision polygon after collision, forcing it to the left. I was trying to recreate another physics bug, but this behavior was so bizarre, I felt it needed to be reported. Not sure how to even properly describe this, so here's a gif:

EswGbm3hqP

Steps to reproduce: Create a RigidBody2D with CollisionPolyon2D collision -- something vaguely ring-like in shape. Let it drop onto a static body that's also a RigidBody2D. (Note: This is pretty much exactly what I did with Goop Loop, and that ring did not have nearly this strange of a behavior, so maybe there's something specific with what I did in this example project):

Minimal reproduction project:
test_wonky_left_movement_on_rigid_body.zip

Edit: Tried creating a new project from scratch and it had the exact same behavior, even though the shape was different. Strange.

Edit2: Realized the reason for this problem. My collision is off-center from the rigid body origin. Not sure what the expected behavior is here, but maybe this isn't a bug.

@akien-mga
Copy link
Member

Edit2: Realized the reason for this problem. My collision is off-center from the rigid body origin. Not sure what the expected behavior is here, but maybe this isn't a bug.

I guess this might be expected behavior then since the calculated moment of inertia will likely induce an acceleration if the body is not in a stable state. CC @godotengine/physics to review.

@madmiraal
Copy link
Contributor

Yes, it's behaving as expected. I've put our Godot logo at the centre of mass and zoomed out to show you what is happening, and you can see that it's behaving as expected:

47745

@Calinou
Copy link
Member

Calinou commented Apr 9, 2021

See also godotengine/godot-proposals#945.

@akien-mga
Copy link
Member

It might be interesting to add a debug visualization of the center of mass in the editor (though that's material for a proposal :)).

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

4 participants