Collision problem with SAT and polygons

Sep 5, 2009 at 7:42 PM
Edited Sep 5, 2009 at 7:43 PM

Hi,

I have a problem that only occurs when I use the SAT narrow phase collision detection.

I have a very simple polygon and a rectangle that sits on top of it.  However when the rectangle slides over the edges of the polygon it "slips into it", as if the corners were not really there.  I have taken some screenshots here:

http://pencelgames.com/FarseerQuestion.aspx

Is this some limitation of SAT?  My polygon is not concave.

Coordinator
Sep 5, 2009 at 7:51 PM

Is that the release version or the one from SVN? SAT has some bugs at the moment and I can't really fix them unless Matthew is here. The SVN version is a rewritten SAT implementation, but it might have some other bugs (I know Matthew mentioned some jittering).

I'm focusing on FPE 3.0 that has a very stable (and fast) SAT implementation, so all my time is taken. Try out the SVN version and let me know if it works for you.

Sep 5, 2009 at 9:11 PM

Cheers for the swift reply genbox, it is the release version I am using.  I will try the SVN version ans see how it goes.

Sep 9, 2009 at 11:01 PM
Edited Sep 17, 2009 at 8:05 PM

I tried the SVN version but found it too hard to get working with my existing game.

I did find a workaround though if anyone faces the same issue.  SAT works fine for paths if you keep the paths as they are shown in the documentation where it talks about terrain.  So if I keep all my paths to 4 points and just use lots together to create vertical slices of my terrain and all is working fine now.

EDIT: above workaround didn't actually work, please see Cowdozers post below for a proper fix

Sep 14, 2009 at 3:51 AM

Hi Beringela,

 

If your workaround is working fine for you, that's good, but in case it isn't, I brought up this same issue in this thread. The issue I found was that:

"In the SAT Collide() method, no Contacts are added to the contactList for any body where IsStatic == true. This is good for ensuring that two static bodies don't collide, but if only one body is static, I think we need to be including Contacts from both geometries."

So by including Contacts from both geometries, you'll solve the problem.

Sep 17, 2009 at 8:03 PM

Thanks Cowdozer, I actually just recently found that my workaround wasn't, well, a workaround at all, it just made the fault a bit less likely to happen.  Your solution I think is the correct one, which I think may also be in the latest build from SVN.

Thanks very much for the input, I now have stable SAT collisions!