Phaser API Documentation

  Version: 
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Event: COLLIDE
Phaser.Physics.Arcade.Events.COLLIDE
COLLIDE

Description:

The Arcade Physics World Collide Event.

This event is dispatched by an Arcade Physics World instance if two bodies collide and at least one of them has their onCollide property set to true.

It provides an alternative means to handling collide events rather than using the callback approach.

Listen to it from a Scene using: this.physics.world.on('collide', listener).

Please note that 'collide' and 'overlap' are two different things in Arcade Physics.

Parameters:

name type description
gameObject1 Phaser.GameObjects.GameObject

The first Game Object involved in the collision. This is the parent of body1.

gameObject2 Phaser.GameObjects.GameObject

The second Game Object involved in the collision. This is the parent of body2.

body1 Phaser.Physics.Arcade.Body | Phaser.Physics.Arcade.StaticBody

The first Physics Body involved in the collision.

body2 Phaser.Physics.Arcade.Body | Phaser.Physics.Arcade.StaticBody

The second Physics Body involved in the collision.

Since: 3.0.0