Arcade physics collider

A Collider is an object for checking collisions between multiple physics objects. The Scene Editor allows creating a collider by dragging it from the Blocks view to the scene:

Adding a collider.

The collider objects are shown in the Arcade section of the Outline view:

Collider in the outline.

When you select it, it shows the collider properties in the Inspector view. Each parameter corresponds to a parameter in the Collider constructor:

Collider parameters.

The properties are:

The scene compiler verbatim-compies the values of the parameters (excepting overlapOnly) into the code. So you can write any JavaScript valid expression as value for the parameter.

In the case of the Object 1 and Object 2 parameters, you have the option of selecting the variable name of an object of the scene:

Select a variable name of an object of the scene.

In addition to objects, you can reference an Object List.

So, the collider object is generated in code using the collider or overlap methods of the Arcade Factory class. Something like this:

const collider_stone = this.physics.add.collider(gorilla, stone, this.onCollideGorillaWithStone, undefined, this);

Or, if the Overlap Only parameter is selected:

const collider_stone = this.physics.add.overlap(gorilla, stone, this.onCollideGorillaWithStone, undefined, this);

In addition to the Collider properties, it contains the Variable properties.

Updated on