Phaser API Documentation

  Version: 
<static> GetRectangleToRectangle(rectA, rectB, [out])

Description:

Checks if two Rectangles intersect and returns the intersection points as a Point object array.

A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. As such, the two Rectangles are considered "solid". A Rectangle with no width or no height will never intersect another Rectangle.

Parameters:

name type arguments description
rectA Phaser.Geom.Rectangle

The first Rectangle to check for intersection.

rectB Phaser.Geom.Rectangle

The second Rectangle to check for intersection.

out array <optional>

An optional array in which to store the points of intersection.

Returns:
Description:

An array with the points of intersection if objects intersect, otherwise an empty array.

Type:
  • array
Examples: