physics-matter

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

Updated Jun 10, 2026
One-click install
npx skills add https://github.com/mudman1986/quarterless --skill physics-matter-mudman1986
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: physics-matter
Source: https://github.com/mudman1986/quarterless/tree/main/.github/skills/physics-matter
Command: npx skills add https://github.com/mudman1986/quarterless --skill physics-matter-mudman1986

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up full rigid-body physics in Phaser 4 requires knowing the Matter.js API surface: bodies, constraints, composites, sensors, collision filtering, and world configuration. This Skill provides the complete reference and working patterns so you can build physics-driven gameplay without digging through source files. ## Core Features & Use Cases - Body and Game Object Creation: Create Matter sprites, images, and 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 collision events to manage interactions. - Use Case: Build a platformer where the player is a Matter sprite with custom friction and bounce, the tilemap layer is converted to static physics bodies, and a sensor zone triggers a level exit when the player overlaps it. ## Quick Start Use the physics-matter skill to set up a Phaser 4 scene with Matter physics, a controllable player sprite, and static ground bodies.

Frequently Asked Questions about physics-matter

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

FAQPage Schema
How do I enable Matter.js physics in a Phaser 4 game?

Set physics.default to 'matter' in the game config and pass a matter object with gravity, setBounds, enableSleeping, and debug options. Then create bodies in your scene with this.matter.add.sprite, image, or shape factory methods.

How do I create constraints and springs in Matter.js with Phaser?

Use this.matter.add.constraint(bodyA, bodyB, length, stiffness, options) to create joints, springs, or pins. High stiffness near 1 gives a rigid joint, while low values like 0.02 with damping create springy behavior.

What is the difference between Arcade Physics and Matter.js in Phaser?

Arcade Physics is a lightweight AABB system for simple collisions, while Matter.js provides full rigid-body simulation with rotation, compound bodies, constraints, and realistic friction and restitution. Choose Matter when you need true physics behavior.

How do I make a Matter body act as a sensor or trigger zone?

Set isSensor: true in the body config or call sprite.setSensor(true). Sensors detect collisions through normal collisionstart and collisionend events but produce no physical response, making them ideal for pickups and trigger areas.

Why does my Matter body stop colliding after changing its shape?

Calling setBody, setRectangle, or similar methods resets all body properties including mass, friction, collision filters, and callbacks. Re-apply collision categories, filters, and event callbacks after changing the body shape.

How many collision categories does Matter.js support?

Matter.js supports a maximum of 32 collision categories because each category occupies one bit in a bitmask. Use this.matter.world.nextCategory() to allocate them, or use collision groups for simpler always-collide or never-collide rules.