Phaser home
Phaser AE
Open source
Phaser 4
Download
Learn
Editor
Tools
Docs
Examples
News
Log in
Examples
/
Physics
/
Matterjs
Phaser 4.1.0
Phaser 4 examples
Matterjs
67
examples
Examples
67
Add Matter Physics to a TileSprite
Demonstrates how to apply Matter JS physics to a TileSprite, allowing it to have physical properties like gravity and collisions while maintaining its scrolling texture capabilities.
Basic Constraint
Demonstrates how to create a basic constraint between two Matter.js physics bodies, specifying the resting length and stiffness.
Circle Stack
Demonstrates creating a grid of circular physics bodies using the Matter.js stack helper and manually syncing sprite positions to the physics engine.
Compound Body
Create a complex physics body in Matter.js by combining multiple primitive shapes, such as rectangles and circles, into a single compound object.
Create Matter.js Sensor
Demonstrates how to create a sensor in Matter.js, allowing a physics body to detect collisions and triggers events without causing a physical reaction.
Destroy Matter Body
Demonstrates how to remove a Matter.js physics body and its associated Game Object from the simulation using the destroy method.
Drag Matter Physics Bodies
Demonstrates how to enable interactive dragging of Matter.js physics bodies using a pointer constraint or mouse spring.
Drag Through Balls
Demonstrates dragging a heavy Matter JS body through a field of particles that are configured to ignore direct pointer interaction.
Draw Chain
Create a dynamic chain of Matter.js physics bodies by dragging the pointer, linking segments with constraints based on movement distance.
Draw Matter Triangles
Learn how to dynamically create small triangle physics bodies in the Matter.js engine by clicking and dragging the pointer.
Draw Stiff Line
Create a path of static Matter.js bodies connected by constraints while drawing with the mouse, forming a rigid obstacle for falling objects.
Drawing Smooth Physics Lines
Demonstrates how to create smooth visual paths using Spline curves while simultaneously generating a chain of static Matter.js bodies and constraints to act as physical barriers.
Fixed Rotation
Demonstrates Matter.js physics bodies interacting with a tilted static platform while maintaining a fixed orientation.
Ignore Gravity
This example demonstrates how to prevent specific Matter.js physics bodies from being affected by world gravity using the setIgnoreGravity method.
Is Point Within Body
Demonstrates how to check if a world coordinate point is contained within different Matter.js physics bodies and dynamically update their visual style.
Matter Body Follow Path
Demonstrates how to move a Matter.js physics body along a spline curve by manually updating its position based on the curve points.
Matter Body from Vertices
Demonstrates how to create a complex physics body from a path of vertices using Matter.js, allowing for custom collision shapes beyond basic primitives.
Matter Body Scale
Demonstrates how to scale a Matter.js physics body and its associated sprite dynamically during runtime.
Matter Body to JSON
Demonstrates how to export a Matter.js physics body configuration to a JSON object using the toJSON method.
Matter Body Velocity
Demonstrates how to manually set the horizontal and vertical velocity of a Matter.js physics body using setVelocity and setVelocityX.
Matter Custom Polygon Bodies
Demonstrates how to create complex Matter physics bodies from custom vertex data strings to match the shape of polygon game objects.
Matter JS Bridge
Create a flexible suspension bridge using a stack of physics bodies linked by a chain and anchored with world constraints.
Matter JS Collision Filtering
Demonstrates how to use collision categories and masks to control which physics bodies interact with each other and which pass through.
Matter JS Collision Groups
Demonstrate how to control body interactions using Matter.js collision groups and categories to enable or disable collisions between specific objects.
Matter JS Compound Sensors
Demonstrates how to create a complex Matter.js body using multiple parts, including sensors with custom labels to detect directional collisions.
Matter JS Scene Transition
Demonstrates how to transition between two different Scenes that both utilize Matter JS physics.
Matter JS Shape Bounds and Alignment
Demonstrates how to use body bounds and center of mass offsets to precisely position Matter JS physics bodies relative to their visual display.
Matter JS Thrust
Demonstrates using Matter.js thrust methods for omnidirectional movement and linking particle emitter properties to a physics body's speed.
Matter JS World Bodies and Camera Navigation
Create a large Matter JS physics world populated with random polygons and rectangles. This example demonstrates world bounds, mouse interaction via mouseSpring, and camera navigation including panning, zooming, and rotation.
Matter No Gravity
Demonstrates how to configure the Matter.js world with zero gravity so that physics bodies remain stationary by default.
Matter Physics Balls
Create multiple circular physics bodies with Matter.js, demonstrating how to set world boundaries, friction, and restitution (bounce) properties.
Matter Physics Bullet Pool
Learn how to manage a pool of projectiles in Matter Physics by cycling active states and manually adding or removing bodies from the physics world.
Matter Physics Circle Body
This example shows how to change a Matter.js physics body from a default rectangle to a circle with a specific radius and apply velocity and bounce properties.
Matter Physics Compound Body from JSON
Demonstrates how to import complex collision shapes exported from Physics Editor and assemble them into a compound Matter.js body using JSON data and the PhysicsEditorParser.
Matter Physics Debug Options
Demonstrates the extensive debug visualization features available in Matter.js, including the rendering of convex hulls, joint constraints, springs, velocity vectors, and sleep states.
Matter Physics Drag Filter
Demonstrates how to use collision filters with a mouse constraint to restrict which physics bodies can be dragged by the pointer.
Matter Physics Simple Body
An introduction to adding dynamic physics bodies and a static platform using the Matter.js physics engine.
Matter Physics with Bitmap Text
Demonstrates how to add a Matter.js physics body to a Bitmap Text object, allowing it to fall, bounce, and collide with other physical bodies.
Matter Physics with Text Objects
Demonstrates how to add Matter.js physics bodies to Text Game Objects, using both default rectangular bounds and custom polygon shapes.
Matter Physics Wrap Bounds
Demonstrates how to use the wrapBounds property in Matter.js to automatically wrap physics bodies around the screen when they exit a defined area.
Matter Scene Restart
Demonstrates how to restart a scene containing Matter physics bodies, effectively resetting the simulation and all objects to their initial state on a pointer click.
Matter Snake Chain
Demonstrates how to create a chain of circular bodies connected by springs in Matter.js to simulate a snake-like physics structure that can be manipulated with the mouse.
Matter.js Attractors
Demonstrates how to use attractors in Matter.js to create gravitational effects, pulling multiple physics bodies toward a specific object.
Matter.js Body Scaling
Demonstrates how to dynamically increase the scale of a Matter.js physics body and its associated sprite texture through user interaction.
Matter.js Chain
Demonstrates how to create a physics chain by connecting a sequence of bodies using joints. Includes a keyboard-controlled anchor block and mouse interaction.
Matter.js Chamfer Bodies
Demonstrates how to create physics bodies with rounded corners (chamfering) using uniform or per-vertex radius settings for rectangles and polygons.
Matter.js Circular Body
Demonstrates how to create a circular physics body in Matter.js, including setting friction, bounce, and initial velocity.
Matter.js Cloth
Create a cloth-like simulation using a soft body composed of particles and constraints. The example demonstrates how to pin the top row of particles to make it hang and interact with it using a mouse spring.
Matter.js Collision Event
Listen for the collisionstart event in the Matter physics world to detect when two bodies collide and manipulate their parent Game Objects.
Matter.js Container Collision
This example demonstrates how to apply Matter.js physics to a Container. It highlights the requirement of setting the container size before enabling physics and shows how to handle collision events for a physics-enabled container and its children.
Matter.js Custom Physics Shapes from JSON
Demonstrates how to load complex Matter.js physics bodies from a JSON file exported by PhysicsEditor and apply them to sprites.
Matter.js Point Intersections
Demonstrates how to use the intersectPoint method to detect and retrieve all Matter.js physics bodies located at a specific coordinate, such as under the mouse pointer.
Mixed Bodies
Demonstrates creating a variety of Matter.js physics bodies, including random polygons and rectangles, with mouse spring interaction enabled.
Move Matter Body with Cursors
Demonstrates how to control a Matter.js physics body using keyboard cursor keys to set horizontal and vertical velocity in a zero-gravity environment.
Multiple Physics Scenes
Demonstrates how Matter.js physics worlds are independent and isolated within each Scene, allowing for smooth transitions between different physics-enabled levels.
Offset Matter.js Physics Body
Demonstrates how to adjust the render offset of a sprite to correctly align its texture with a custom-shaped Matter.js physics body.
Pachinko
A Pachinko game demonstration using Matter.js collision categories and masks, featuring a moving bucket sensor and static pins.
Particles Follow Matter Body
Demonstrates how to attach a particle emitter to a Matter.js physics body and dynamically adjust particle speed, lifespan, and alpha based on the body's current velocity.
Physics Editor with Matter.js
Demonstrates how to load and apply complex custom body shapes, exported from a physics editor JSON file, to Matter.js game objects and containers.
Polygon Physics Body
Demonstrates how to create a regular polygon-shaped physics body in Matter.js by defining the number of sides and a radius.
Rectangle Physics Body
Learn how to define a custom-sized rectangular physics body for a sprite in Matter.js, overriding the default texture dimensions.
Restart Physics Scene
This example demonstrates how to transition between scenes and restart a Matter.js physics-enabled scene, showing how the physics world is automatically managed when scenes stop and start.
Rotate Body With Cursors
Control a Matter.js physics body using keyboard input to apply angular velocity for rotation and thrust for movement, featuring a particle trail that reacts to speed.
Sleep Events
Demonstrates how to use Matter.js sleep events to track when physics bodies come to rest or wake up. Objects are tinted red when they enter a sleeping state and return to normal when moved.
Top Down Car Movement
Demonstrates top-down vehicle physics using Matter.js, including thrust, air friction, and applying steering forces at specific points on the physics body.
Trapezoid Matter Body
Demonstrates how to create a custom trapezoid-shaped physics body in Matter.js using the slope property.
Wrecking Ball
Demonstrates creating a stable stack of crates in Matter.js by increasing physics solver iterations and adding mouse interaction.