• Advertisement
Sign in to follow this  

Collision detection hell !! Need advice..

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

Hi everyone. I'm currently working on a 2d puzzle game with four other people that is based around guiding a body of water through a level: Free Image Hosting at www.ImageShack.us I'm running into severe difficulties though with the collision detection, having already tried 4 different approaches to the problem and having no luck with either. I need to be able to move arbitrary sized circles around a level and resolve any collisions with geometry in such a way that the response seems smooth (around corners) and that the circles don't end up in a position where they intersect any other geometry (within most reasonable situations at least). I'm doing a static collision test that is incremented in fixed step sizes of less than the circles radius, this is in case the circle skips over any geometry. I also have a BSP tree generated for the level to help narrow down what lines need to be tested against. So far the most favorable approach has been to find the closest 'hit' point on all lines tested against and move the sphere away from this point so that it is at radius lenght away. Normally this 'hit' point is a point gotten by projecting the circles center point perpendicularily down onto a line, but in some cases it may be either end point of the line (happens when colliding with corners). This approach seems to make for nice smooth response, especially around corner points. However it fails occasionally when the circle gets into a narrow crevice where the angle between the two node lines is acute. What happens in this case is that one line will move the circle along its normal past the other, and the circle will end up going through all the geometry. Has anyone got any suggestions for a collision detection scheme that would produce nice smooth results but still stop the circles from passing through things ? Any help would be greatly appreciated, I think I'm gonna go bannanas if I don't crack this problem soon ! [totally] I have so much other stuff to be working on and can't afford to be spending much more time on this problem. Thanks for your help.

Share this post


Link to post
Share on other sites
Advertisement
Hi Darragh,

take a look at http://www.geocities.com/oswaldovarela/colisioni.htm. It solved all my collision troubles. It is about "Swept Sphere Collision Detection" but I guess it can be easily adopted to 2D. The PDF http://www.geocities.com/oswaldovarela/zips/colision.zip explains all the theory behind it and also includes source code for collision detection and response.

Hope this helps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement