How do you do Collison detection in a cricle rather then rectangle
i was wondering how do you test for collision if your object is a circle and you dont want to test for a rectangle but rather a circle ? I never have done anything with circles or polygons so could someone show an example?
Circle collision is much easier than rectangle collision. The test for this looks like this:
If SQRT((Circle1.X, Circle1.Y) ^ 2 + (Circle2.X, Circle2.Y)^ 2) <= Circle1.Radius + Circle2.Radius Then
''Collision Detected
Else
''No Collision
End If
That''s how simple it is. I basically test the distance between both center points of the circles, Then it checks if that distance is less then the combined radius of the two circles. If the distance is les then there has been a collision.
That''s it
Horny Farmer (Jolly Rancher)
If SQRT((Circle1.X, Circle1.Y) ^ 2 + (Circle2.X, Circle2.Y)^ 2) <= Circle1.Radius + Circle2.Radius Then
''Collision Detected
Else
''No Collision
End If
That''s how simple it is. I basically test the distance between both center points of the circles, Then it checks if that distance is less then the combined radius of the two circles. If the distance is les then there has been a collision.
That''s it
Horny Farmer (Jolly Rancher)

This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement