Phaser home
Phaser AE
Open source
Phaser 4
Download
Learn
Editor
Tools
Docs
Examples
News
Log in
Examples
/
Geom
/
Point
Phaser 4.1.0
Phaser 4 examples
Point
18
examples
Examples
18
Creating and Drawing Points
Demonstrates how to initialize Vector2 objects using various constructor arguments and render them as filled shapes using a Graphics object.
Get Bounding Rectangle from Points
Demonstrates how to calculate a bounding box that encompasses a dynamic set of points using Phaser.Math.GetVec2Bounds.
Get Centroid
Demonstrates how to use Phaser.Math.GetCentroid to calculate and visualize the geometric center of a dynamic set of points.
Get Magnitude Squared
Demonstrates using Vector2.lengthSq to efficiently check distances between points by avoiding expensive square root calculations.
Invert Point
Demonstrates using the invert method to negate the x and y components of a Vector2 point.
Negate a Point
Demonstrates how to use the negate method to invert the coordinates of a Vector2, reflecting it across a central origin.
Point Ceil
Demonstrates rounding a point's coordinates up to the nearest integer using the ceil method.
Point Floor
Demonstrates how to use the floor method to round a point's coordinates down to the nearest integer value.
Point Magnitude
Calculates and displays the magnitude (length) of a Vector2 relative to the origin as it follows the mouse pointer.
Point Negation Pattern
Demonstrates creating symmetrical geometric patterns by using the negate method on vectors to flip their coordinates relative to an origin.
Project onto Unit Vector
Demonstrates projecting a vector onto a normalized (unit) vector using the projectUnit method.
Vector Cross Product
Demonstrates how to use the cross product of two 2D vectors to calculate the angle between them and determine their relative orientation.
Vector Interpolation
Calculates a point between two Vector2 objects using the lerp method, visualizing the movement along a line connecting a fixed point and the mouse pointer.
Vector Projection
Demonstrates how to project one vector onto another using the project method, visualizing the resulting point on a rotating line.
Vector2 Clone
Demonstrates how to use the clone method to create copies of a Vector2 object, generating a sequence of unique points to define a path.
Vector2 Copy From
Demonstrates how to use the copy method to transfer coordinates from the pointer to a Vector2 object, creating a motion trail effect.
Vector2 Equality Check
Demonstrates how to use the equals method to compare if two Vector2 objects share the same x and y coordinates.
Vector2 Set To
Demonstrates using the setTo method to update the coordinates of a Vector2 object with various argument combinations.