Phaser API Documentation

  Version: 
setCollidesWith(bodies, categories)

Description:

Sets the collision filter mask of all given Matter Bodies to the given value.

Two Matter Bodies with different collision groups will only collide if each one includes the others category in its mask based on a bitwise AND operation: (categoryA & maskB) !== 0 and (categoryB & maskA) !== 0 are both true.

Parameters:

name type description
bodies Array.<Phaser.Types.Physics.Matter.MatterBody>

An array of bodies to update. If falsey it will use all bodies in the world.

categories number | Array.<number>

A unique category bitfield, or an array of them.

Returns:
Description:

This Matter Physics instance.

Since: 3.22.0