How to disable collision between relatives bodies? For example, I have a lot of balls, they fall and collide by walls, but they should not collide with themselves. Please someone explain how to make it?
It looks like you're looking for "Collision Filtering"...
https://brm.io/matter-js/demo/#collisionFiltering
https://github.com/liabru/matter-js/blob/master/examples/collisionFiltering.js
I haven't tried it. But if I'm understanding this correctly, it looks like you'd create a "walls" category, then set a "collisionFilter" on the balls, where the mask would be the "walls".
It looks like you're looking for "Collision Filtering"...
https://brm.io/matter-js/demo/#collisionFiltering
https://github.com/liabru/matter-js/blob/master/examples/collisionFiltering.jsI haven't tried it. But if I'm understanding this correctly, it looks like you'd create a "walls" category, then set a "collisionFilter" on the balls, where the mask would be the "walls".
No, it not works for me. Because relatives bodies collide between themselves, cause they gonna have the same mask.
Well, how many balls are there? If it's 30 or less, why not create a group for each ball, one for walls and one general group?
I think you could set the balls all to have a negative group e.g. -1 and the walls a positive group (default is 0 so that's fine).
Would that work? You can combine these with masks too. If you need something really custom, you could patch Detector.canCollide with your own logic.