Edge-Face Collision detection between sphere and box

Started by
3 comments, last by LorenzoGatti 12 years ago
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!
Advertisement
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.
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?
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!
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).

Omae Wa Mou Shindeiru

This topic is closed to new replies.

Advertisement