Skip to main content
gamedev.net
🔒 Locked

collision question

Started by Kris2456 Jan 11, 2005 at 2:34 PM 2 replies 450+ views
Original Post
Kris2456
Kris2456
Very simply. How would i go about testing for a collision between a box and a sphere. thx
------------ "Here lies a toppled God,His fall was not a small one,We but built his pedastle,A narrow, and a tall one" Frank Herbert (Dune:Messiah)
matthughson
matthughson
The easiest way I've found is to expand the sides of the box by the radius of the sphere. You can then just check if the point (the center of the sphere) is inside the 'new' box.

Hope this helps!

Matt Hughson
__________________________________[ Website ] [ Résumé ] [ [email=contact[at]matthughson[dot]com]Contact[/email] ][ Have I been Helpful? Hook me up! ]
oliii
oliii
fins closest point on the perimeter of the box to the sphere centre. check if that point is in the sphere. YOu also can use that point to push the sphere away from the box so it stops intersecting.
Everything is better with Metal.
Zakwayda
Zakwayda
There was a thread with some code and discussion of this algorithm recently in the math and physics forum. Try searching for 'Avro's algorithm' to find it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.