geometry-and-math

Featured

Use this skill when using Phaser 4 math and geometry utilities. Covers vectors, rectangles, circles, triangles, polygons, random number generation, angles, distance, interpolation, and snapping. Triggers on: Vector2, Rectangle, Circle, math, distance, angle, random, lerp.

AI & Automation 957 stars 79 forks Updated today MIT

Install

View on GitHub

Quality Score: 93/100

Stars 20%
99
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Phaser 4 — Geometry and Math > Geom classes (Circle, Ellipse, Line, Polygon, Rectangle, Triangle), intersection tests, and Math utilities (Vector2, Vector3, Matrix4, angles, distances, interpolation, easing, random, snap, clamp). Related skills: graphics-and-shapes.md, physics-arcade.md --- ## Quick Start ```js // Create geometry objects (these are data only, not renderable) const rect = new Phaser.Geom.Rectangle(10, 20, 200, 100); const circle = new Phaser.Geom.Circle(400, 300, 50); const line = new Phaser.Geom.Line(0, 0, 100, 100); // Point containment rect.contains(50, 50); // true circle.contains(410, 310); // true // Intersection test Phaser.Geom.Intersects.CircleToRectangle(circle, rect); // boolean // Math utilities const v = new Phaser.Math.Vector2(3, 4); v.length(); // 5 v.normalize(); // {x: 0.6, y: 0.8} const dist = Phaser.Math.Distance.Between(0, 0, 100, 100); const angle = Phaser.Math.Angle.Between(0, 0, 100, 100); const clamped = Phaser.Math.Clamp(150, 0, 100); // 100 ``` --- ## Core Concepts Geometry objects are pure data containers holding coordinates and dimensions. They are NOT game objects and cannot be added to the display list. To render geometry, use the Graphics game object or Shape game objects (see graphics-and-shapes.md). Every geom class has a `type` property set to a `Phaser.Geom` constant for fast type checks. All geom classes share a common instance method pattern: - `contains(x, y)` -- point-in-shape test - `getPoint(po...

Details

Author
autonomous-ai
Repository
autonomous-ai/openharness
Created
1 months ago
Last Updated
today
Language
C
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category