Skip to content

Conversation

rburing
Copy link
Member

@rburing rburing commented Sep 28, 2022

Delete dead code which was presumably left over from testing. I didn't manage to understand the Math::abs(h) <= 1.0 case in the dead code, or find an other physics engine with a cylinder support mapping that looks like that. For example, in the p_normal direction indicated by the raycast in the picture below, the dead code would return the red point as the support point:

cylinder_support?

But the red point is not a true support point, since e.g. all the points directly above it on the cylinder surface are "more extreme" points in the p_normal direction (they have a higher dot product with p_normal).

For posterity I observe that GodotCylinderShape3D::get_support (which replaces the dead code) is almost the support function from page 8 of A Fast and Robust GJK Implementation for Collision Detection of Convex Objects by Gino van den Bergen, except for (the use of !Math::is_zero_approx(s) instead of s > 0.0, and) the different $x$-coordinate in the "otherwise" case.

@akien-mga akien-mga merged commit 6b5880b into godotengine:master Sep 28, 2022
@akien-mga
Copy link
Member

Thanks!

@rburing rburing deleted the cylinder_support_is_dead branch September 28, 2022 21:54
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.

2 participants