geometry-and-math

Reference Phaser 4 geometry classes, intersection tests, and math utilities for game development.

Updated Jun 10, 2026
One-click install
npx skills add https://github.com/mudman1986/quarterless --skill geometry-and-math-mudman1986
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: geometry-and-math
Source: https://github.com/mudman1986/quarterless/tree/main/.github/skills/geometry-and-math
Command: npx skills add https://github.com/mudman1986/quarterless --skill geometry-and-math-mudman1986

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Phaser 4 developers often need quick, accurate guidance on geometry objects, intersection tests, vectors, matrices, easing, and random number generation without digging through the full engine source or documentation. ## Core Features & Use Cases - Geometry and Intersection Reference: Covers Circle, Ellipse, Line, Polygon, Rectangle, and Triangle classes plus all boolean and point-returning intersection tests under Phaser.Geom.Intersects. - Math Utilities Catalog: Documents Vector2, Vector3, Matrix4, angle and distance functions, interpolation, easing, snapping, fuzzy comparison, and the seeded RandomDataGenerator. - Color Utilities: Explains the Phaser.Display.Color class, HSV/RGB conversion, and color interpolation helpers. - Use Case: While building a Phaser platformer, you need to detect whether a line of sight crosses a wall rectangle and smoothly rotate an enemy toward the player; this Skill provides the exact API calls and gotchas. ## Quick Start Ask how to test whether a circle overlaps a rectangle in Phaser 4 and how to compute the angle between two points.

Frequently Asked Questions about geometry-and-math

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if two shapes overlap in Phaser 4?

Use the boolean tests under Phaser.Geom.Intersects, such as CircleToRectangle or RectangleToRectangle, which return true or false. For actual intersection points, use the Get* variants like GetLineToCircle, which return Vector2 arrays.

How do I use Vector2 for movement and direction in Phaser?

Create a Phaser.Math.Vector2, then use methods like normalize, scale, rotate, and lerp to compute directions and velocities. Methods mutate in place and return this for chaining, so call clone() first if you need to preserve the original vector.

Does Phaser 4 still have the Point class?

No, the Point class was removed in Phaser 4. Use Phaser.Math.Vector2 or plain {x, y} objects instead for representing coordinates.

How do I generate reproducible random numbers in Phaser?

Use Phaser.Math.RandomDataGenerator with a seed, or the global Phaser.Math.RND instance seeded via the game config seed property. Its state is serializable via rnd.state(), enabling deterministic replay and save/load.

Why can't I add a Phaser.Geom.Rectangle to the display list?

Geom objects are pure data containers, not game objects, so they have no scene or texture. To render them, use the Graphics game object or Shape game objects instead.

Are Phaser math angles in degrees or radians?

Phaser math APIs use radians throughout. Convert with Phaser.Math.DegToRad and RadToDeg, and use the TAU constant for full-circle calculations.