physics-matter

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

Updated Sep 20, 2026
One-click install
npx skills add https://github.com/AmirOssanloo/helix-game --skill physics-matter-amirossanloo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: physics-matter
Source: https://github.com/AmirOssanloo/helix-game/tree/main/.claude/skills/physics-matter
Command: npx skills add https://github.com/AmirOssanloo/helix-game --skill physics-matter-amirossanloo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up full-body physics in Phaser 4 with Matter.js involves many APIs—bodies, constraints, composites, sensors, collision filtering, and debug rendering—and small mistakes (wrong force magnitudes, wiped body properties, misconfigured collision masks) cause subtle bugs. This Skill provides a complete operational reference so an AI agent can write correct Matter.js physics code on the first attempt. ## Core Features & Use Cases - Body and Game Object Creation: Create Matter sprites, images, and physics-enabled Game Objects with rectangle, circle, polygon, trapezoid, vertex, or PhysicsEditor shapes. - Constraints and Composites: Build joints, springs, world constraints, stacks, chains, meshes, soft bodies, cars, and Newton's cradles. - Collision Control: Configure sensors, collision categories, groups, masks, and per-body or world-level collision callbacks and events. - Use Case: Build a platformer where the player is a Matter sprite with custom friction and bounce, enemies use collision categories so bullets skip the player, static tilemap layers are converted to physics bodies, and pointer dragging is enabled via mouseSpring. ## Quick Start Ask the AI to set up a Phaser 4 scene with Matter.js physics including a controllable player sprite, static ground bodies, and collision events.

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 config block for gravity, bounds, and debug. Then create bodies in a scene using this.matter.add.sprite, image, rectangle, or circle, and control them with setVelocity and applyForce.

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

Use this.matter.add.constraint(bodyA, bodyB, length, stiffness, options) for joints and springs, or worldConstraint to pin a body to a fixed point. Stiffness of 1 gives a rigid joint; low values like 0.02 with damping create spring behavior.

Matter.js vs Arcade Physics in Phaser, which should I use?▼

Matter.js provides full rigid-body simulation with rotation, constraints, compound bodies, and realistic collisions, while Arcade Physics is lighter with axis-aligned boxes. Choose Matter when you need joints, stacking, or polygon shapes.

Does Phaser Matter physics support collision filtering between bodies?▼

Yes, Matter uses bitmask categories and masks. Assign categories with world.nextCategory(), then call setCollisionCategory and setCollidesWith on bodies. Collision groups offer a shortcut: same negative group never collides, same positive always collides.

Why does my Matter body lose its properties after changing shape?▼

Calling setBody, setRectangle, setCircle, or similar methods resets all body properties including mass, friction, collision filters, and callbacks. Re-apply every property after changing the body shape to restore the intended behavior.

How do I convert a Phaser tilemap layer into Matter physics bodies?▼

First mark colliding tiles with layer.setCollisionByProperty, then call this.matter.world.convertTilemapLayer(layer). It creates a MatterTileBody per colliding tile, using Tiled collision shapes when defined or tile bounds otherwise.