Performs a collision check and separation between the two physics enabled objects given, which can be single Game Objects, arrays of Game Objects, Physics Groups, arrays of Physics Groups or normal Groups.
If you don't require separation then use Phaser.Physics.Arcade.World#overlap instead.
If two Groups or arrays are passed, each member of one will be tested against each member of the other.
If only one Group is passed (as
object1), each member of the Group will be collided against the other members.
If only one Array is passed, the array is iterated and every element in it is tested against the others.
Two callbacks can be provided; they receive the colliding game objects as arguments.
If an overlap is detected, the
processCallback is called first. It can cancel the collision by returning false.
Next the objects are separated and
collideCallback is invoked.
Arcade Physics uses the Projection Method of collision resolution and separation. While it's fast and suitable for 'arcade' style games it lacks stability when multiple objects are in close proximity or resting upon each other. The separation that stops two objects penetrating may create a new penetration against a different object. If you require a high level of stability please consider using an alternative physics system, such as Matter.js.
The first object or array of objects to check.
The second object or array of objects to check, or
An optional callback function that is called if the objects collide.
An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then
The context in which to run the callbacks.
true if any overlapping Game Objects were separated, otherwise