[Feedback] b2ContactFilter::ShouldCollide

Hi!

I was just wondering: is there a particular reason, why the collide code is linked with an AND?
Code:
bool collide = (filter1.maskBits & filter2.categoryBits) != 0 && (filter1.categoryBits & filter2.maskBits) != 0;


In my opinion, this results in cross-referencing when creating objects, as they only collide if they both have adequate settings.
Since I am planning to create a sort of real time editor (with Flash), I'd also want to let the user create categories on the fly - which would really be a pain for the user to keep these up to date I guess.

If I simply change the AND to an OR, like so:
Code:
bool collide = (filter1.maskBits & filter2.categoryBits) != 0 || (filter1.categoryBits & filter2.maskBits) != 0;

everything gets much easier, and results in less work. Also, I think it's a bit more the behavior of what the user might expect (if one object says collide, it ought to be enough).

I'd now be interested: what is your / are your opinions about this? Is there any chance to get this change into the main branch or should I just create my own contact filter? Last is no problem of course, I'm just curious what the background of the decision to implement it that way was 🙂
(if it just happened that way, it's ok too 😉 )

Thanks!
Christian
Just have the default for a given bit of masks being 1. So when you create a new category, it does collide with everything until they opt out.

But sure, change the function if you like. It's part of b2ContactFilter, right? If you check the manual, you can see this is replaceable without changing library code, precisely because people might want different semantics.
Alright, thanks for your opinion! 🙂

Original thread: https://box2d.org/forum/viewtopic.php?t=3820