Phaser API Documentation

  Version: 
setOnCollideWith(body, callback)

Description:

The callback is sent a reference to the other body, along with a Phaser.Types.Physics.Matter.MatterCollisionData object.

This does not change the bodies collision category, group or filter. Those must be set in addition to the callback.

Parameters:

name type description
body MatterJS.Body | Array.<MatterJS.Body>

The body, or an array of bodies, to test for collisions with.

callback function

The callback to invoke when this body collides with the given body or bodies.

Returns:
Description:

This Game Object.

Since: 3.22.0