Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / Game Design & Programming / line segment & circle collision (2D) Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
arctwelve

February 01, 2005, 12:28 AM

I'm having a bit of trouble with collision and projection between line segments and circles. What is the best way to handle this? Assuming the line segments make up the terrain and the circle is colliding with the terrain, like a wheel.

My specific problem is when two segments are joined and they form a pointed convex shape, as the circle travels over that, I get either missed detection, or popping behavior. I tried a number of different strategies but couldn't get anything really nice and smooth for all cases.

TIA

 
minionx

February 11, 2005, 02:58 PM

I think you just need to get yourself a good closest-point-on-line function.

This way, even if you are checking your cicrle against several line segments, some of which may form peaks as you say, you should be able to just take the closest result that you get from your checks. You could then take the distance between the closest point and the origin of your circle, and compare it to the radius of your circle, to see if you are touching/embedded in one of the line segments.

 
This thread contains 2 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.