-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Cylinder support in Godot Physics 3D #45854
Conversation
b2c59b9
to
c1b757f
Compare
Cylinder collision detection uses a mix of SAT and GJKEPA. GJKEPA is used to find the best separation axis in cases where finding it analytically is too complex. Changes in SAT solver: Added support for generating separation axes for cylinder shape. Added support for generating contact points with circle feature. Changes in GJKEPA solver: Updated from latest Bullet version which includes EPA fixes in some scenarios. Setting a lower EPA_ACCURACY to fix accuracy problems with cylinder vs. cylinder in some cases.
c1b757f
to
333f184
Compare
Updated |
Thanks! |
r_amount = 1; | ||
r_type = FEATURE_POINT; | ||
r_supports[0] = get_support(p_normal); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why here is return?
It should be described why is here or just removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I forgot to clean the code after doing some tests. The return and code below should be removed, but I don't know if it's worth a specific PR.
A lot of the issues seen in my example come from using a cylinder collider with godot physics, getting stuck doesn't happen with bullet or seem to with godot physics and a capsule collider: #57048 |
Cylinder collision detection uses a mix of SAT and GJKEPA. GJKEPA is used to find the best separation axis in cases where finding it analytically is too complex.
It's mostly functional but will still require fixing specific cases and it can benefit from further optimization.
Changes in SAT solver:
Added support for generating separation axes for cylinder shape.
Added support for generating contact points with circle feature.
Changes in GJKEPA solver:
Updated from latest Bullet version which includes EPA fixes in some scenarios (https://code.google.com/archive/p/bullet/issues/606)
Setting a lower EPA_ACCURACY to fix accuracy problems with cylinder vs. cylinder in some cases.
Known issues:
-Cylinder is not stable when resting on its disk on a dense triangle mesh. Some extra contact points are probably needed to help support in face-circle cases, more investigation is needed.
-Cylinder vs. convex polyhedron could probably be solved analytically for better performance.
-Some cases might benefit from specific optimization, especially when it comes to using GJKEPA with no margin.
Project used for tests on 4.0:
cylinder-tests-4.0.zip
It would be interesting to backport cylinder support to 3.2 once it's considered stable enough since it doesn't affect other areas of the physics server. I'll make a separate PR later.