physics-matter

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

2|10|Updated Jul 28, 2026
One-click install
npx skills add https://github.com/kodingvibes/gamejam-2026 --skill physics-matter-kodingvibes
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: physics-matter
Source: https://github.com/kodingvibes/gamejam-2026/tree/main/participantes/jpyunism/.agents/skills/physics-matter
Command: npx skills add https://github.com/kodingvibes/gamejam-2026 --skill physics-matter-kodingvibes

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 it is easy to misuse force scales, collision bitmasks, or body configuration. This Skill provides a complete operational reference so you can implement Matter.js physics correctly on the first attempt. ## Core Features & Use Cases - Body and Game Object Creation: Create Matter sprites, images, rectangles, circles, polygons, vertex-based shapes, and compound bodies with proper configuration options. - Constraints and Composites: Build joints, springs, chains, stacks, soft bodies, cars, and Newton's cradles, plus pointer-based mouse dragging. - Collision Control: Configure collision categories, groups, sensors, per-body callbacks, and world-level collision events, including tilemap layer conversion. - Use Case: You are building a 2D platformer for a game jam and need a player character with realistic bounce and friction, static ground from a tilemap, and draggable crates—this Skill gives you the exact config, factory calls, and event wiring to do it. ## Quick Start Ask the AI to set up a Phaser 4 scene with Matter.js physics including a controllable player sprite, static ground bounds, and mouse dragging for bodies.

Frequently Asked Questions about physics-matter

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

FAQPage Schema
How do I set up Matter.js physics in Phaser 4?▼

Enable Matter physics by setting physics.default to 'matter' in the game config with a matter options object for gravity, bounds, and debug. Then create bodies in your scene using this.matter.add.sprite, image, rectangle, or circle.

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

Use this.matter.add.constraint(bodyA, bodyB, length, stiffness, options) to create joints or springs between bodies. High stiffness near 1 makes a rigid joint, while low values like 0.02 with damping create springy 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 collision filtering, while Arcade physics is lighter with axis-aligned boxes. Choose Matter when you need realistic physics interactions like stacks, chains, or soft bodies.

Does Phaser Matter physics support collision filtering between objects?▼

Yes, Matter uses bitmask-based collision filtering with category, mask, and group properties. Call this.matter.world.nextCategory() to allocate categories, then use setCollisionCategory and setCollidesWith on bodies, with a maximum of 32 categories.

Why are my Matter.js forces not moving bodies in Phaser?▼

Matter.js force values are very small, typically 0.01 to 0.1, while velocity values range from 1 to 15; they are not pixel-based. If applyForce seems ineffective, increase the magnitude or use setVelocity for direct movement control.

How do I make a Phaser tilemap collide with Matter bodies?▼

First mark colliding tiles with layer.setCollisionByProperty, then call this.matter.world.convertTilemapLayer(layer) to generate a MatterTileBody per colliding tile. Tiled collision shapes are used if defined, otherwise tile bounds apply.