This project has moved and is read-only. For the latest updates, please go here.

Enable continuous collisions for specific objects?

Topics: Developer Forum
Mar 21, 2013 at 8:09 PM
I've done a lot of searching and can't find an answer, so I'll ask here:

I have a fairly large number of physics objects in most of my levels, but some are much more important than others (and pretty small). Occasionally these objects go through walls, which throws off the gameplay.

Is there any way to turn on Continuous Collision Detection for only certain objects? Or rather, can I turn on CCD and disable it for most objects (or certain categories, for instance). I'm using FPE 3.3 I believe.

Thanks in advance!
Luke Schneider
Mar 21, 2013 at 9:04 PM
Ok, looks like I just answered my own question.

I tried turning on CCD for the whole game, and the push-throughs stopped happening, but some other weirdness started with other object types (some collision-damage/bounce stuff I use no longer worked). So that wasn't an option. NOTE: I'd also tried playing with the other Iteration variables but no combination could stop the push-throughs.

Then I found the Fixture flag called IgnoreCCDWith. It does exactly what I wanted. I turned CCD back on, then set IgnoreCCDWith to Category.All for everything except for the small objects. They are set to Category.None (there aren't very many and don't do anything fancy, so I don't mind if they CCD with everything even if they don't need to).

That gives the best of both worlds. Main objects still function normally, and no more push-throughs for the important small objects (other small objects still push through on occassion).

Yay Farseer Physics!