Jump to content
  • Advertisement
Sign in to follow this  
Avenyr

Edge-Face Collision detection between sphere and box

This topic is 2309 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

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 this post


Link to post
Share on other sites
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.

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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).

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!