Checks to see if the target body, or an array of target bodies, intersects with any of the given bodies.
If intersection occurs this method will return
true and, if provided, invoke the callbacks.
If no bodies are provided for the second parameter the target will check again all bodies in the Matter World.
Note that bodies can only overlap if they are in non-colliding collision groups or categories.
If you provide a
processCallback then the two bodies that overlap are sent to it. This callback
must return a boolean and is used to allow you to perform additional processing tests before a final
outcome is decided. If it returns
true then the bodies are finally passed to the
overlapCallback, if set.
If you provide an
overlapCallback then the matching pairs of overlapping bodies will be sent to it.
Both callbacks have the following signature:
function (bodyA, bodyB, collisionInfo) where
bodyA is always
the target body. The
collisionInfo object contains additional data, such as the angle and depth of penetration.
|target||Phaser.Types.Physics.Matter.MatterBody | Array.<Phaser.Types.Physics.Matter.MatterBody>||
The target body, or array of target bodies, to check.
The second body, or array of bodies, to check. If falsey it will check against all bodies in the world.
An optional callback function that is called if the bodies overlap.
An optional callback function that lets you perform additional checks against the two bodies if they overlap. If this is set then
The context, or scope, in which to run the callbacks.
true if the target body intersects with any of the bodies given, otherwise