Phaser API Documentation

  Version: 
setCollisionCategory(bodies, value)

Description:

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

This number must be a power of two between 2^0 (= 1) and 2^31.

Bodies with different collision groups (see #setCollisionGroup) will only collide if their collision categories are included in their collision masks (see #setCollidesWith).

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.

value number

Unique category bitfield.

Returns:
Description:

This Matter Physics instance.

Since: 3.22.0