geometry-and-math

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

465|41|Updated Aug 4, 2026
One-click install
npx skills add https://github.com/autonomous-ai/openharness --skill geometry-and-math-autonomous-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: geometry-and-math
Source: https://github.com/autonomous-ai/openharness/tree/main/store/agents/phaser/skills/geometry-and-math
Command: npx skills add https://github.com/autonomous-ai/openharness --skill geometry-and-math-autonomous-ai

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 when writing game logic. This Skill provides a complete reference so you can implement vectors, shapes, intersection tests, random generation, and interpolation correctly on the first try. ## Core Features & Use Cases - Geometry Classes: Covers Circle, Ellipse, Line, Polygon, Rectangle, and Triangle with constructors, properties, containment tests, and static helper functions. - Intersection Tests: Documents all boolean overlap checks and Get* functions that return intersection points under Phaser.Geom.Intersects. - Math Utilities: Details Vector2, Vector3, Matrix4, angles, distances, easing, snapping, fuzzy comparison, interpolation, and the seeded RandomDataGenerator. - Use Case: When building a top-down shooter, use this Skill to compute the angle between the player and cursor, test bullet-to-enemy collisions with CircleToRectangle, and spawn enemies at seeded random positions. ## Quick Start Ask the AI to write Phaser 4 code that checks whether a circle overlaps a rectangle and moves a sprite toward a target using Vector2 math.

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 collision between a circle and rectangle in Phaser 4?

Use Phaser.Geom.Intersects.CircleToRectangle(circle, rect), which returns a boolean indicating overlap. For the actual intersection points, use GetCircleToRectangle, which returns an array of Vector2 points where the circle meets the rectangle edges.

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

Create a vector with new Phaser.Math.Vector2(x, y), then use methods like normalize(), scale(), and setToPolar() to control direction and speed. Methods mutate in place and return this for chaining, so call clone() first if you need to preserve the original.

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.

How do I generate seeded random numbers in Phaser?

Use Phaser.Math.RandomDataGenerator, available globally as Phaser.Math.RND and seeded via the game config seed property. It provides between(), realInRange(), pick(), shuffle(), and a serializable state for deterministic replay.

Why is my Phaser geometry object not rendering on screen?

Geom objects are pure data containers, not game objects, so they cannot be added to the display list. To render them, use the Graphics game object or Shape game objects instead.

When should I use squared distance instead of Distance.Between in Phaser?

Use Phaser.Math.Distance.Squared or vector.distanceSq() whenever you only need to compare distances, such as finding the nearest enemy. It avoids the Math.sqrt call, making it faster in hot loops like per-frame updates.