physics-matter

Implements Matter.js rigid-body physics in Phaser 4 scenes.

Updated Jul 13, 2026
One-click install
npx skills add https://github.com/russellmorgan/UnderConstruction --skill physics-matter-russellmorgan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: physics-matter
Source: https://github.com/russellmorgan/UnderConstruction/tree/main/.claude/skills/physics-matter
Command: npx skills add https://github.com/russellmorgan/UnderConstruction --skill physics-matter-russellmorgan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up full-body physics in Phaser 4 requires knowing Matter.js concepts like bodies, constraints, collision filtering, and sensors, plus how Phaser wraps them. This Skill provides the complete API surface and working patterns so you can build physics-driven gameplay without digging through Phaser source code. ## Core Features & Use Cases - Body and Game Object Creation: Create Matter sprites, images, and raw bodies (rectangles, circles, polygons, vertex shapes, PhysicsEditor data) with full configuration options. - Constraints and Composites: Build joints, springs, chains, stacks, soft bodies, cars, and Newton's cradles, plus pointer-based mouse dragging. - Collision Control: Use collision categories, groups, sensors, per-body callbacks, and world events to manage exactly what collides and how your game responds. - Use Case: Building a Pachinko-style game where balls bounce through a peg field — create circle bodies for balls, static pegs with restitution, sensor zones for scoring, and collision events to award points on each peg hit. ## Quick Start Ask the AI to set up a Phaser 4 scene with Matter physics where a ball drops through static pegs and triggers a callback when it lands in a sensor zone.

Frequently Asked Questions about physics-matter

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

FAQPage Schema
How do I add Matter.js physics to a Phaser 4 game?▼

Set physics.default to 'matter' in the game config with a matter options object for gravity, bounds, and debug. Then create bodies in your scene with this.matter.add.sprite, this.matter.add.image, or shape factories like this.matter.add.rectangle.

How to create constraints and springs in Phaser Matter physics?▼

Use this.matter.add.constraint(bodyA, bodyB, length, stiffness, options) to join two bodies; stiffness 1 gives a rigid joint while low values like 0.02 with damping create springs. Use worldConstraint to pin a body to a fixed point.

Does Phaser Matter physics support collision filtering between specific bodies?▼

Yes, Matter uses bitmask categories and masks. Assign categories with this.matter.world.nextCategory(), call setCollisionCategory on bodies, and use setCollidesWith to control which categories interact. Collision groups offer a shortcut for always or never colliding.

What is the difference between Matter Sprite and Matter Image in Phaser?▼

Matter Sprite extends Phaser's Sprite and supports animations, while Matter Image extends Image and is lighter weight without animation support. Both default to a rectangle body matching the texture size, overridable via options.shape.

Why do my Matter.js forces seem to have no effect in Phaser?▼

Matter force values are very small, typically 0.01 to 0.1, while velocity values range from 1 to 15 per step. If applyForce does nothing, increase the magnitude or use setVelocity for direct movement control instead.

How do I make a sensor trigger zone in Phaser Matter physics?▼

Create a body with isSensor set to true, often combined with isStatic. Sensors detect collisions without physical reaction and fire normal collisionstart and collisionend events, which you handle on this.matter.world or per-body callbacks.