# Edge-Face Collision detection between sphere and box

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

## Recommended Posts

I've managed to implement collision detection between a sphere and a box with Vertex-Face and Face-Face but the I'm not sure how to approach Edge-Face collisions when the face of my sphere collides with one of the edges of the box.

I'm not sure if what I did is standard or easily adaptable to Edge-Face but how would I go about detecting this type of collision?

Thanks!

##### Share on other sites
Hmm ... why do make it so complicated?

When you know you have a sphere and a box colliding with each other, why don't you use the implicit representation of the sphere? ( (x-x0)^2 + (y-y0)^2 + (z-z0)^2 = r^2 ), where (x0,y0,z0) is the origin of the sphere.

... and a transformed box, where the box is either an object oriented bbox, or you just use an axis aligned bbox, and transform the sphere into your local AABB space, which might make the collision detection easier.

Maybe this applies to your case, if not, I apologize...
... though finding the point(s) of intersection here is not so intuitive.

##### Share on other sites
I'm a little confused - spheres don't have faces, or edges - are you talking about a polygonised sphere?

In which case you want convex vs convex polyhedra?

##### Share on other sites
Sorry about the lack of details on my part. I am using the terminology of the book I am using. When I say face I mean the surface of the sphere in it implicit representation. I am not using the actual sphere polygon for this. That would be way too troublesome and also very inefficient I believe.

I am more concerned about understanding the concept than performance at the moment. I currently found an implementation that satisfies proper collision detection and resolution for the surface of my sphere colliding with one of the box's edges.

I found a technique involving finding the shortest distance between a point and a line which is what I am using. I am quite happy with the results. I'm not sure how efficient it is but I understand how it works

Thanks for your time and help guys!

##### Share on other sites
If the sphere intersects two adjacent faces of your convex polyhedron it intersects their shared edge and if it intersects an edge it intersects both adjacent faces, because both shapes are convex: edge and vertex collisions can be deduced from face collisions.
if you have working sphere-convex polygon tests there is no apparent need to add cheaper sphere-segment collision tests: you still need to test faces because the sphere can intersect them without intersecting edges (penetrating the middle of a face, far from any edge).

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 11
• 15
• 21
• 26
• 11