Phaser API Documentation

  Version: 
setCollisionGroup(bodies, value)

Description:

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

If the group value is zero, or if two Matter Bodies have different group values, they will collide according to the usual collision filter rules (see #setCollisionCategory and #setCollisionGroup).

If two Matter Bodies have the same positive group value, they will always collide; if they have the same negative group value they will never collide.

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 group index.

Returns:
Description:

This Matter Physics instance.

Since: 3.22.0