physics-matter

Configure and run Matter.js physics inside Phaser 4 for 2D game scenes.

Updated Jun 21, 2021
One-click install
npx skills add https://github.com/mahirocoko/mahirocoko --skill physics-matter-mahirocoko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: physics-matter
Source: https://github.com/mahirocoko/mahirocoko/tree/main/plugins/phaser/skills/physics-matter
Command: npx skills add https://github.com/mahirocoko/mahirocoko --skill physics-matter-mahirocoko

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Uses Matter.js physics inside Phaser 4 to provide robust, realistic physics simulations for games, including rigid bodies, constraints, composites, sensors, and collision filtering.

Core Features & Use Cases

  • Define bodies with shapes (rectangles, circles, polygons), sensors, and collision filters for dynamic gameplay.
  • Configure world properties (gravity, bounds, debug rendering) and work with tiles, stacks, chains, and soft bodies for rich scenes.
  • Use interactive demos like pointer dragging, joints, and composite structures to demonstrate physics behavior in real-time.

Quick Start

Start a Phaser 4 scene with Matter physics, add a dynamic sprite and a static ground, then observe collision responses.

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 for rigid body collisions?

To set up Matter.js physics in Phaser 4, configure the Phaser-Matter API to create a scene with dynamic sprites and static ground, allowing the physics engine to automatically simulate realistic rigid body collisions.

Can I use constraints and joints in Phaser 4 game development?

Yes, you can use constraints and joints in Phaser 4 game development by leveraging the Matter.js integration to link rigid bodies together, enabling interactive mechanics like pointer dragging and complex composite structures.

What physics features are available for 2D game scenes using Matter.js in Phaser?

Matter.js in Phaser provides robust 2D physics features including rigid bodies, sensors, collision filters, custom shapes like polygons, world gravity configuration, and advanced structures like stacks, chains, and soft bodies.

How do I configure world properties like gravity and bounds in a Phaser 4 physics scene?

You configure world properties like gravity and bounds in a Phaser 4 physics scene by using the Phaser-Matter API to define the simulation environment, set debug rendering options, and manage global physical interactions.

Does Phaser 4 support collision filtering and sensor bodies for dynamic gameplay?

Phaser 4 supports collision filtering and sensor bodies through the Matter.js physics engine, allowing developers to define custom shapes and control which specific bodies interact during dynamic gameplay simulations.

When should I use Matter.js over other 2D physics approaches in game development?

You should use Matter.js in game development when your 2D scenes require advanced physics simulations like soft bodies, chains, complex constraints, and composite structures that demand robust rigid body interactions.