As already mentioned in the title, I am looking for a way, to disable every collision of a body in Matter.js. It should still be linkable with Constraints, and there should be the possibility of enabling the collision again after some time. Is there a way to do this? The hard thing about it, is that the object should not collide with any other object, but all the other objects should collide with each other.
You can use collision filters to do this. You can see an example of them working in the collision filtering demo and the source code.
They work similarly to how they do in Box2d, for which there is a good article you can use to get an idea of how they work.
see
Matter.IBodyDefinition.isSensor
in order to disable physical collisions for the Body. The Body can still be used as a sensor for collisions.
来源:https://stackoverflow.com/questions/32683832/javascript-matter-js-disable-collision-for-one-body