geometry-and-math

Provide geometry classes and math utilities for Phaser 4 games.

Updated Apr 20, 2026
One-click install
npx skills add https://github.com/Raphe-dev/phaser-cozy-mmo --skill geometry-and-math
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: geometry-and-math
Source: https://github.com/Raphe-dev/phaser-cozy-mmo/tree/main/skills/geometry-and-math
Command: npx skills add https://github.com/Raphe-dev/phaser-cozy-mmo --skill geometry-and-math

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Geometry and math utilities for Phaser 4 simplify creating and manipulating shapes, performing geometric tests, and performing common math tasks in games and visualizations, saving time and reducing boilerplate.

Core Features & Use Cases

  • Geometry classes such as Circle, Ellipse, Line, Polygon, Rectangle, and Triangle for data-only shapes with fast type checks and common methods for containment, perimeter points, random points, and positioning.
  • Comprehensive math utilities (Distance, Angle, Interpolation, Random, Vector2/Vector3, Matrix4) to support game logic, physics, and rendering calculations.
  • Intersection tests and helpers for fast collision checks and geometry-based logic (e.g., rectangle-circle overlap, line intersections, point containment).

Quick Start

Create a Rectangle and a Circle using Phaser.Geom and verify containment and basic intersection tests in a quick example.

Frequently Asked Questions about geometry-and-math

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

FAQPage Schema
How do I perform collision detection and shape intersection tests in Phaser 4?

Collision detection in Phaser 4 is handled through built-in intersection tests for geometric shapes like rectangles, circles, and lines, allowing fast overlap checks and point containment verification for game logic.

What geometry classes are available in Phaser 4 for constructing game shapes?

Phaser 4 provides data-only geometry classes including Circle, Ellipse, Line, Polygon, Rectangle, and Triangle, which feature fast type checks and methods for containment, perimeter points, and random positioning.

How do I calculate distance and angles using Phaser 4 math utilities?

Distance and angle calculations are performed using Phaser 4 math utilities, which support game logic and physics rendering by providing specialized helpers for measuring geometric relationships and vector math operations.

Does Phaser 4 include vector math utilities for game physics calculations?

Yes, Phaser 4 includes Vector2, Vector3, and Matrix4 math utilities designed to support complex game physics calculations, visualizations, and spatial transformations without requiring custom boilerplate code.

What is the best way to check if a point is contained within a polygon in Phaser 4?

The best way to check point containment within a polygon is using the Phaser 4 Geom Polygon class, which offers built-in methods to verify if specific coordinates fall inside the defined shape boundaries.

Can I generate random points along a shape's perimeter using Phaser 4 geometry?

Yes, you can generate random points along a shape's perimeter using the common methods provided by Phaser 4 Geom classes, which return specific coordinates useful for positioning objects within game visualizations.