physics-matter

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up full-body physics in Phaser 4 requires navigating Matter.js concepts like rigid bodies, constraints, collision filtering, and sensors, which are easy to misconfigure without a consolidated reference. ## Core Features & Use Cases - Body and World Setup: Configure gravity, bounds, sleeping, debug rendering, and create sprites, images, and compound bodies with custom shapes. - Constraints and Composites: Build joints, springs, chains, stacks, soft bodies, cars, and Newton's cradles with the factory API. - Collision Control: Use categories, groups, sensors, and collision callbacks to manage interactions, plus tilemap integration for level geometry. - Use Case: Build a platformer where the player drags crates with the mouse, triggers sensor zones, and collides with tilemap-based terrain using filtered collision categories. ## Quick Start Set up a Phaser 4 scene with Matter.js physics including a player sprite, static ground, and pointer dragging.

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 game?

Set physics.default to 'matter' in the game config and pass a matter config object with gravity, setBounds, enableSleeping, and debug options. Then create bodies in your scene using this.matter.add.sprite, image, or shape 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 makes rigid joints, while low values like 0.02 with damping create springy connections.

What is the difference between Matter physics and Arcade physics in Phaser?

Matter.js provides full rigid-body simulation with rotation, constraints, compound bodies, and realistic collision response, while Arcade physics is a lightweight AABB system. Matter positions bodies by center of mass rather than top-left origin.

How does collision filtering work in Matter.js?

Matter uses bitmask categories and masks: assign each body a category with setCollisionCategory, then define what it hits with setCollidesWith. Groups override category and mask, where matching negative groups never collide and matching positive groups always collide.

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

Matter.js force values are very small, typically between 0.01 and 0.1, while velocity values range from 1 to 15. Forces are not pixel-based, so scale your values accordingly or use setVelocity for direct movement control.

How do I make a Matter.js sensor or trigger zone?

Pass isSensor: true in the body options or call setSensor(true) on a Matter Game Object. Sensors detect collisions through normal collisionstart and collisionend events without producing physical reactions, but still need matching collision filters.