🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Contact Area triangle sphere

Started by
3 comments, last by Dirk Gregorius 6 years, 3 months ago

Hello,

It is a complicated subject I think, but how would you compute the contact area between a sphere and a triangle? 

I thought to use the GJK algorithm combined with the EPA algorithm, but it could be the wrong way.

Advertisement

I have used GJK+EPA for convex vs. sphere collision detection and it works fine with a Bullet-like constraint solver, provided your implementation of those algorithms are good/fast. Just be sure to terminate the EPA when the distance from the support point to the closest polytope triangle is less than some reasonably small value (e.g. 1mm).

You should use GJK, except treat your sphere as a point. Then once you compute closest points, consider the radius after the fact. You can then take the distance between your witness points and compare it to your sphere radius to determine a hit. It is trivial to compute a contact point and normal once the witness points are available. You can use a special case to handle when the sphere center lays directly on the triangle.

EPA should not be used for sphere to triangle.

You compute the closest point of the sphere center to the triangle with your favorite method. GJK would work, but is not necessary. The contact point is the closest point on the triangle, The contact normal is the difference vector of the closest point and the sphere center (normalized). The penetration depth is the distance of the sphere center to the closest point minus the radius.

If you want to actual area you would need to clip the sphere against the triangle plane and then against the three side planes through each edge I guess. I don't see  extra points adding more stability though.

I gave a talk on contact point creation a while ago. Maybe this is useful:

http://media.steampowered.com/apps/valve/2015/DirkGregorius_Contacts.pdf

This topic is closed to new replies.

Advertisement