Sphere - Polygon collision detection
You need to find the closest point from the center of the sphere to the plane that the triangle lies on, and then check to see if it inside the triangle. If so, then you check the distance between that point and the center of the sphere. If that passes, then you definitely have a collision. If not, then you have to check to see whether the sphere has collided with an edge. The algorithm is pretty simple, if you need more specific math, I can post the actual equations for you.
The closest point on the sphere isn''t what you need. The closest point on the plane that the triangle is on to the center of the sphere is what you need. You should be able to do a simple google search to find code to do it, or I can post some.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement