Jump to content
  • Advertisement
Sign in to follow this  
umen242

2d Circle different ARC's Collision detection

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

The way to detect collision between 2 circles or circle and line . using trigonometry
But now i like be able to detect which part of the circle arcs im hitting , for example i divided my circle to 4 different sized arcs. i will like to know which ARC of the Circle is bean hit . 1 ,2 ,3, or 4 See image 
what is the best collision detection algorithm for this ? or how does it called ?F4fP5px.png

Share this post


Link to post
Share on other sites
Advertisement

If you know the point on the circle that is colliding with the other circle or the line, you can determine the angle between whatever direction the circle is "facing" (if the circle, and thus the individual arcs, can rotate around the center) and the collision point. The arcs can then just be thought of as angle-ranges (0 through PI/2, Pi/2 through 3Pi/2, etc.).

Edited by NoAdmiral

Share this post


Link to post
Share on other sites

If you got the local closest point on the circle, just use arctan2 to get the angle for that point.

Secondly bring that angle into range 0 - 2*PI (google: normalize angle radians)

Detect region/arc from that normalized angle. Done.

Share this post


Link to post
Share on other sites

Do you have the point of intersection worked out?

 

atan2 can give you the angle if you feed it the y,x position relative to the center of the circle. The angle it gives will consider zero degrees/radians to be pointing toward the right.

 

Each one of your arcs has a start angle and an end angle, so just look to see which range your angle is in.

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!