Jump to content
  • Advertisement
Sign in to follow this  
coderchris

Using Separating Axis Thm. With Spheres?

This topic is 4221 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there any way to adapt SAT (3D) to handle spheres? I would rather not have many different collision algorithms for the different shape types, so using SAT for everything would be good. From what I gather, spheres have an infinite number of axes and edges, and it would be just plain slow to even consider more than 20 of them (that wouldnt be accurate either) Any tips?

Share this post


Link to post
Share on other sites
Advertisement
Use the axis going through the circle center and the closest point (or, for two circles, the axis through both centers).

Share this post


Link to post
Share on other sites
I think there's a theorem that for convex polyhedrons it is sufficient to test the axes corresponding to the face normals and the cross products of pairs of edges from each polyhedron. If the polyhedrons are not colliding, then at least one of these axes will be a separating axis.

The separating axis theorem merely states that two convex shapes aren't colliding if and only if there exists a separating axis. It says nothing about how to go about finding if a separating axis exists.

If two spheres are not colliding then the axis in the direction from the center of one sphere to the center of the other is a separating axis (easily proven with a proof from contradiction). Therefore you need only check that one axis. If it is a separating axis, then the spheres are not colliding. If it is not a separating axis, then the spheres must be colliding. Much simpler than trying to apply a theorem for general convex polyhedrons to other shapes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!