# Using Separating Axis Thm. With Spheres?

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

## 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 on other sites
Use the axis going through the circle center and the closest point (or, for two circles, the axis through both centers).

##### 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.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634056
• Total Posts
3015282
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!