Search code examples
javascriptgame-physicsphysicsmatter.js

Matter js: is there a way for a group of bodies to collide with each other and for another group: the last group is acting like a sensor?


I would something like surviv.io : items on the ground (circles with weapon) collide with each other but for the players, items are only sensors. How can I do this?

I tried collisionFilter.category and mask, but the player is not detecting the circle body for an event.

enter image description here


Solution

  • I asked the question on the Matter.js GitHub (https://github.com/liabru/matter-js/issues/691) and the creator suggest me to pin 2 bodies together (1 solid body and 1 sensor)

    enter image description here