Phaser API Documentation


Member of: Phaser.Geom.Point

<static> ProjectUnit(pointA, pointB, [out])


Calculates the vector projection of pointA onto the nonzero pointB. This is the orthogonal projection of pointA onto a straight line paralle to pointB.


name type arguments description
pointA Phaser.Geom.Point

Point A, to be projected onto Point B. Must be a normalized point with a magnitude of 1.

pointB Phaser.Geom.Point

Point B, to have Point A projected upon it.

out Phaser.Geom.Point <optional>

The Point object to store the position in. If not given, a new Point instance is created.


A unit Point object holding the coordinates of the vector projection of pointA onto pointB.

Since: 3.0.0