geometry-and-math

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

2|10|Updated Jul 28, 2026
One-click install
npx skills add https://github.com/kodingvibes/gamejam-2026 --skill geometry-and-math-kodingvibes
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: geometry-and-math
Source: https://github.com/kodingvibes/gamejam-2026/tree/main/participantes/jpyunism/.agents/skills/geometry-and-math
Command: npx skills add https://github.com/kodingvibes/gamejam-2026 --skill geometry-and-math-kodingvibes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Phaser 4's geometry and math APIs span dozens of classes and hundreds of functions, making it hard to recall exact signatures, static helpers, and v4-specific changes while building game logic. ## Core Features & Use Cases - Geometry Classes: Covers Circle, Ellipse, Line, Polygon, Rectangle, and Triangle with constructors, properties, and static helper functions. - Intersection Tests: Documents all boolean and point-returning functions under Phaser.Geom.Intersects for collision and overlap checks. - Math Utilities: References Vector2, Vector3, Matrix4, angles, distances, interpolation, easing, snapping, fuzzy comparison, and seeded random generation. - Use Case: When implementing a line-of-sight check in a Phaser game, look up LineToRectangle intersection tests and use the reusable out-array pattern to avoid garbage collection in the update loop. ## Quick Start Ask how to test whether a circle overlaps a rectangle in Phaser 4 and which math utilities to use for the surrounding logic.

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 to use Vector2 for movement and direction in Phaser?▼

Create a Phaser.Math.Vector2 and use methods like normalize, scale, setToPolar, and rotate 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. The GEOM_CONST.POINT constant still exists but the class itself does not.

Can I render Phaser geometry objects directly to the screen?▼

No, Geom objects like Circle and Rectangle are pure data containers and cannot be added to the display list. To render them, use the Graphics game object or Shape game objects.

How do I create reproducible random sequences in Phaser?▼

Use Phaser.Math.RandomDataGenerator with a seed string, or the global Phaser.Math.RND seeded via the game config seed property. Call rnd.state() to serialize and restore the generator state for deterministic replay.

Why is my Phaser angle calculation giving wrong results?▼

Phaser math functions use radians, not degrees. Convert with Phaser.Math.DegToRad() and RadToDeg(), and use Angle.Wrap or Angle.Normalize to keep values in the expected range.