Line.intersectsRectangle()

<static> intersectsRectangle(line, rect) → {boolean}

Checks for intersection between the Line and a Rectangle shape, or a rectangle-like
object, with public x, y, right and bottom properties, such as a Sprite or Body.

An intersection is considered valid if:

The line starts within, or ends within, the Rectangle.
The line segment intersects one of the 4 rectangle edges.

The for the purposes of this function rectangles are considered 'solid'.

Parameters
Name Type Description
line Phaser.Line

The line to check for intersection with.

rect Phaser.Rectangle | object

The rectangle, or rectangle-like object, to check for intersection with.

Returns
boolean -

True if the line intersects with the rectangle edges, or starts or ends within the rectangle.

Source code: geom/Line.js (Line 630)
doc_phaser
2017-02-14 10:54:09
Comments
Leave a Comment

Please login to continue.