I think you can use let group = Body.nextGroup(true) to get a non-colliding group, then set body.collisionFilter.group = group of your 100 bodies to that same group?
Awesome! it worked! All the bodies which are in that group aren't colliding.
Out of curiosity, could you explain why it's still colliding with the walls? (it's the expected behavior, but I was wondering how the system works) 馃槃
@florinpop17 you can find the information in the documentation here http://brm.io/matter-js/docs/classes/Body.html#property_collisionFilter
The properties you're looking for are body.collisionFilter, body.collisionFilter.category, body.collisionFilter.group, and body.collisionFilter.mask
In short (if I understand and explain correctly):
Group is a number. If two bodies have the same positive group number, they always collide. If they have the same negative group number, they never collide (these are your 100 objects). Otherwise we check the category and mask (your walls have no group, so your walls fall under this 'otherwise' situation. See next bullet point).
The category and mask are bit sets. Each body belongs to one single collision category (one bit in the group bit set), and collides against any other body in a category that collides with the mask (any number of bits in the mask bit set). The default setting for the category and mask of every body is to collide with everything (this is why your walls collide with the 100 objects).
Yeah I think that's pretty much it, thanks @AndrewBrownK. To be fair, I'm not a huge fan of the approach and there's a discussion around making it better in #341.
Most helpful comment
@florinpop17 you can find the information in the documentation here http://brm.io/matter-js/docs/classes/Body.html#property_collisionFilter
The properties you're looking for are
body.collisionFilter,body.collisionFilter.category,body.collisionFilter.group, andbody.collisionFilter.maskIn short (if I understand and explain correctly):
Group is a number. If two bodies have the same positive group number, they always collide. If they have the same negative group number, they never collide (these are your 100 objects). Otherwise we check the category and mask (your walls have no group, so your walls fall under this 'otherwise' situation. See next bullet point).
The category and mask are bit sets. Each body belongs to one single collision category (one bit in the group bit set), and collides against any other body in a category that collides with the mask (any number of bits in the mask bit set). The default setting for the category and mask of every body is to collide with everything (this is why your walls collide with the 100 objects).