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 rotates on collision in 3.2, works fine in 3.1 #35514

Open
Tracked by #45334
comrade96 opened this issue Jan 24, 2020 · 12 comments
Open
Tracked by #45334

RigidBody2D rotates on collision in 3.2, works fine in 3.1 #35514

comrade96 opened this issue Jan 24, 2020 · 12 comments

Comments

@comrade96
Copy link

comrade96 commented Jan 24, 2020

Godot version:
3.1.2

OS/device including version:
Windows 7

Issue description:
When opening a 3.1.2 project on any of the version of godot 3.2 it rotates when collison happens. In 3.1.2 it doesn't rotates only moves.

Steps to reproduce:
Just make any project where rigidbody collides with something in 3.1.2 and then open it in 3.2.

Minimal reproduction project:

@Chaosus Chaosus changed the title RigidBody Roates when opening 3.1.2 project in 3.2 RigidBody Rotates when opening 3.1.2 project in 3.2 Jan 24, 2020
@Chaosus Chaosus added this to the 3.2 milestone Jan 24, 2020
@mikeant42
Copy link

Is the version 3.2 rc3? I believe I'm experiencing the same issue with a vehicle that's rotating to the right in rigidbody mode.

@aaronfranke aaronfranke changed the title RigidBody Rotates when opening 3.1.2 project in 3.2 RigidBody rotates on collision in 3.2, works fine in 3.1 Jan 25, 2020
@comrade96
Copy link
Author

comrade96 commented Jan 25, 2020

To fix it i have to set the angular damp in 3.2 project. But it really irritate me cause in 3.1.2 even if the rigid body has angular damp of 0 still it does not rotate. So i think a fix should happen cause if u have multiple rigid bodies in ur project that really gonna ham per ur mood.

@mikeant42
Copy link

Turns out my issue was unrelated so I managed to fix it.

@akien-mga
Copy link
Member

Can you provide a project that triggers the issue?

@akien-mga
Copy link
Member

We'd really need a test project to debug with and confirm if it's a regression or a project-specific issue.

@comrade96
Copy link
Author

@akien-mga
Copy link
Member

Thanks!

The problem seems to be (in Local.tscn) that the Puck scene has an angular damp of 0, so since the angular velocity is increased on collisions, it's never reduced.

In 3.1 collisions seem to have only a very small impact on angular velocity (less than 0.05), while in 3.2 (and as early as the first build, alpha 0, which is a34b77e) the influence is much stronger (e.g. 25). So something much have changed between 3.1-stable and a34b77e27 that causes collisions to apply a much stronger torque. I don't know if it's a bug or a bug fix, but it would be good to identify it.

@akien-mga
Copy link
Member

I'm running a git bisect to identify the commit that cause it.

@akien-mga akien-mga changed the title RigidBody rotates on collision in 3.2, works fine in 3.1 RigidBody2D rotates on collision in 3.2, works fine in 3.1 Jan 27, 2020
@akien-mga
Copy link
Member

1808c5113a89b30261864786087ef857b96ff9e3 is the first bad commit
commit 1808c5113a89b30261864786087ef857b96ff9e3
Author: yakun.zhang <Raphael10241024@gmail.com>
Date:   Mon May 20 12:19:14 2019 +0800

    Fix some shape2d get_moment_of_inertia error

:040000 040000 7245bf85a2fa32cd52ebb651ae9ca0434f5f90a7 a18803082596ebffda88a007d0e22ec6c9002399 M      servers

That's #29020 CC @raphael10241024

@akien-mga
Copy link
Member

I tested and I confirmed that a local revert of 1808c51 fixes the regression for the project in #35514 (comment).

@akien-mga
Copy link
Member

I tested and I confirmed that a local revert of 1808c51 fixes the regression for the project in #35514 (comment).

That being said, I get similar issues again even after the revert if I set e.g. a mass of 1 instead of 0.01 for the Puck RigidBody2D.

So I'm not sure #29020 is really to blame, but the issue might be with the project code, which worked by chance due to the bug of wrong inertia being used for circle shapes.
If I replace the CircleShape by a CapsuleShape, the same behavior happens even in 3.1.

So IMO it's not a regression per se, it's just a bugfix that exposed a flaw in the game physics logic. I'll keep this open so that others may help debug it and maybe suggest a better way to handle realistic puck physics with Godot's 2D physics engine.

@comrade96
Copy link
Author

Thanks for your so much work , hopefully it will be fixed soon. So that i can smoothly transfer from 3.1 to 3.2 :)

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

5 participants