Circle->Line Collision Response, stop jittering?

BlitzMax Forums/BlitzMax Programming/Circle->Line Collision Response, stop jittering?

codermax(Posted 2013) [#1]
I'm using circle to line collision with Oddball's source from the archives, and the detection part works. But here's the thing - the circle jitters as it moves along a line. I want the circle to be able to "slide" along a line... The response should be that the circle is pushed back enough distance to keep the circle away from the line point(making sure that the circle isn't stuck, not being able to move), but keep it close enough NOT to intersect a great distance into the line, making it jitter as it's relocated.

I've been at this for a couple days and I'm out of ideas, so I'm asking the Blitzmax community for help! I've looked in MANY places here and around the web, but I haven't found the appropriate collision response for this code.

Keep in mind that I didn't indent most of the code, however I indented the problem area and higlighted it here. :)

This is where the problem lies.


Here's the entire source, so no one has to figure out how to make an example to test properly.


And oddball's source, used as "polycollision.bmx" in the main source.



Pete Rigz(Posted 2013) [#2]
I wrote a collision module a while go that can do this. you can get it through SVN here: http://subversion.assembla.com/svn/timelinefx-module/

There's a few examples in the doc folder, and here's one that uses circle to line specifically:



In the case of your code it could be the order in which you're checking for a collision and moving the circle, but that's a guess without looking too closely.


codermax(Posted 2013) [#3]
Hey Pete, thanks a lot for your help. I suck at compiling modules, however yours is just plain bmx code, so it actually worked! Great source by the way.

I've changed my source to use your modules instead, and it works like a charm. Thanks again! :)