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

Properly pass safe margin on initialization. #40377

Merged
merged 1 commit into from
Jul 14, 2020

Conversation

reduz
Copy link
Member

@reduz reduz commented Jul 14, 2020

Fixes jitter.

This bug was introduced by #12713 but it was masked for a long time until f2e5405 exposed it.

Copy link
Contributor

@madmiraal madmiraal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still some jitter, but it does fix the remaining jitter that isn't fixed with #35945.

Godot Physics 3.2

Godot-Physics-32

Godot Physics 3.2 with #35945

Godot-Physics-32-with-35945

Godot Physics 3.2 with #40377

Godot-Physics-32-with-40377

Godot Physics 3.2 with both #35945 and #40377

Godot-Physics-32-with-35945-and

Just be clear, this addresses jitter seen in Godot Physics 3D not the jitter seen in the default Bullet Physics 3D, which is worse and completely solved with #35945.

It's also worth noting that the same solution doesn't work in 2D, because the minimum contact depth in 2D is set to 0.005 (in 3D it is 0.00001). Setting the margin to 0.001 in 2D results in #37798 (which I explain here: #37798 (comment)).

Finally, I notice that it doesn't display this value in the CollisionShape Margin field in the editor, but that's a separate issue.

@reduz
Copy link
Member Author

reduz commented Jul 14, 2020

@madmiraal Jitter should only appear when the advance per frame (usually due to gravity) is less than the margin. If small enough, its not a problem in practice. You can reduce the safe marging even further if you want until you stop seeing it, but that will give you numerical precision errors as you move away from the origin. The default value (fixed now) is a good tradeoff.

@akien-mga akien-mga merged commit 9d97169 into godotengine:master Jul 14, 2020
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 3.2.3.

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

Successfully merging this pull request may close these issues.

3 participants