Collision Filtering with categoryBits/maskBits

Anyone else find this confusing as h3ll.   :huh:

I can’t wrap my head around the documentation found here (near bottom): 

https://docs.coronalabs.com/daily/guide/physics/collisionDetection/index.html#TOC


Normally I use groupIndex to work my way around collisions, but I’m at a point where I need multiple different collisions to not trigger or trigger… so groupIndex would be too limiting.


Initially I thought the maskBits number reflects what it can collide with that has categoryBits value of less then the maskBits value…

But the more I read, the more confused I get and don’t know how to come up with collision logic that I can understand.

Anyone help me here - not sure how to get this… I can’t be the only one?

OK So I decided to draw out the chart in the example with my own things… think this will help me considerably.

-EDIT - SOLVED.  I’d recommend to anyone to draw out the chart and approach it like that.  I couldn’t imagine doing that without drawing it out… then figuring the category/maskbits from there.

phew 

Hi @henson802,

Good to hear the chart helped. For just a couple basic collision filters, sometimes I do the math on the fly (in the code), but for anything more complex, I can’t imagine not using the chart. :slight_smile:

Brent

You may also be interested in roaminggamer’s plugin: https://forums.coronalabs.com/topic/59222-collision-calculator/

It’s a well written document. It just incredibly confusing if you just read the first parts and not using a chart.

I had 7 collisions with multiple separate detections needed. So as you can imagine trying to do it in my head resulted in some frustrations ;)… But after sketching out the chart and reading through the step-by-step guidance, it became much more clear. The chart is a must!

Thanks @Michael W. – I got it now tho and once you make the chart, becomes a lot more straight forward!

Hi @henson802,

Good to hear the chart helped. For just a couple basic collision filters, sometimes I do the math on the fly (in the code), but for anything more complex, I can’t imagine not using the chart. :slight_smile:

Brent

You may also be interested in roaminggamer’s plugin: https://forums.coronalabs.com/topic/59222-collision-calculator/

It’s a well written document. It just incredibly confusing if you just read the first parts and not using a chart.

I had 7 collisions with multiple separate detections needed. So as you can imagine trying to do it in my head resulted in some frustrations ;)… But after sketching out the chart and reading through the step-by-step guidance, it became much more clear. The chart is a must!

Thanks @Michael W. – I got it now tho and once you make the chart, becomes a lot more straight forward!