Create immersive, physics-rich 2D worlds.

Phaser Box2D

A high-performance, industry-standard 2D physics engine built on Box2D v3, delivering incredibly realistic and engaging web game experiences.

High Performance

Our comprehensive conversion of Box2D v3 has been optimized for browser performance, featuring a soft step rigid body solver that delivers excellent stability in physics calculations. This ensures realistic collisions and interactions for immersive gaming experiences.

The island-based sleep management enhances performance by pausing calculations for inactive objects, allowing complex, high-speed games to maintain stable physics without compromising speed.

Accuracy

The Continuous Collision Detection (CCD) system handles high-velocity scenarios with precision, from fast projectiles to rapid character movements. Ray casts and queries provide detailed insights into your physics world, ensuring accurate tracking of all interactions.

The refined physics engine ensures object interactions behave naturally and predictably, reducing bugs and inconsistencies.

Fast Integration

Quickly integrate Phaser Box2D with the framework of your choice and focus on creating your game. Built using modern JavaScript standards, this hand-tuned engine mirrors the original C version while maintaining a lean 70KB size - perfect for instant messenger games and playable ads.

We preserved the original C API function names, making transition easy for Box2D veterans and allowing you to leverage existing resources.

50+ Examples

Explore and experiment with over 50 examples demonstrating the core elements of Box2D.

From complete mini-games to feature showcases, each with the full JavaScript source and an example runner. Here are just a few:

Features

Continuous Collision Detection (CCD)

CCD handles high-velocity objects, ensuring they don't bypass collisions. It constantly checks for intersections, capturing every interaction between fast-moving entities. This feature is essential for high-speed gameplay, where objects like bullets, cars, or falling debris demand accurate collision responses.

Features

Contact Events and Sensors

Contact Events provide detailed feedback on collision points, overlap durations, and distance queries, enabling responsive gameplay elements. Sensors let you create triggers or detection zones without physical interference, perfect for implementing zones that respond to player presence without blocking movement.

Physics Engines Comparison

FeatureArcadeMatter.jsPhaser Box2D
Stacking StabilityNoneLowVery High
Continuous Collision Detection (CCD)NoNoYes
Shape SupportLimitedHighDiverse Range + Compound Shapes
Contact Events and SensorsNoneAvailableDetailed feedback and sensors
Joint TypesNoneDistanceRevolute, Distance, Prismatic, Weld and Wheel
Joint InteractionNoneFrictionLimits, Motors, Springs, Friction
Industry StandardNoPersonal projectYes. 18 years of development.

Download

You need a free Phaser account to download the examples.
Don't have one? Register now.

Files

Phaser Box2D

The library is available under the MIT license.

View the GitHub repository for the Getting Started Guide.

Examples

Explore and experiment with over 50 examples demonstrating the core elements of Phaser Box2D.

FAQs

Does it only work with Phaser, or can I use Pixi?

Despite its title, Phaser Box2D is compatible with any web-based tech stack or framework, including Pixi, React, Vue and more. It is provided as an ESM compatible Module and is not deeply integrated with Phaser itself.

Of course, being Phaser Studio, we include lots of helpful functions that ease use of Box2D with Phaser itself. However, using Phaser isn't a requirement.

Is Phaser Box2D Open Source?

Yes. The original C version of Box2D itself is released under an MIT license and we firmly respect that. Our conversion includes thousands of lines of custom code, which is also now released under the MIT license.

How complicated is it to use?

You are expected to have a solid grasp of JavaScript and ideally previous experience with physics systems. We provide tutorials, API Documentation and over 50 examples to learn from.

What support is available for Phaser Box2D?

Free community-based support is available via our forum and Discord. Customers who have Pro or Enterprise level Phaser Studio accounts can receive priority support from the Phaser Studio team.

Complete list

Features

Download Phaser Box2D

Diverse Shape Support

Supports an array of shapes — convex polygons, circles, capsules, chains, and rounded polygons — allowing complex object modeling.

Multiple Shapes per Body

Allows combining various shapes in one body, providing flexibility in designing composite structures with multi-part interactions.

Collision Filtering

Offers precise control over which objects can interact. Invaluable for games needing unique layers of collision.

Ray Casts, Shape Casts, and Overlap Queries

Delivers powerful tools to detect line-of-sight, aiming, and field-of-view interactions.

Physics Simulation: Stability and Realism

Robust Soft Step Rigid Body Solver

Box2D v3 introduces a new Soft Step solver, delivering greater stability across the board. Built on soft constraints and sub-stepping for accurate, stable simulations.

Continuous Physics for Fast Translations and Rotations

Specialized algorithms prevent tunneling and missed interactions with high-speed objects. Speculative collision is used for realistic results.

Island-Based Sleep Management

Boosts performance by pausing calculations for objects at rest, freeing up processing power for active elements.

Versatile Joint Types

Revolute, distance, prismatic, weld, and wheel joints allow you to create complex structures and mechanisms.

Joint Limits, Motors, Springs, and Friction

Detailed control over joint movement and interaction, from limiting motion ranges to applying motor-driven forces.

Joint and Contact Forces

Precise data on forces exerted during interactions, helping simulate responsive reactions and dynamic gameplay.

Body Movement Events and Sleep Notification

Alerts when an object's state changes, enabling highly responsive and event-driven gameplay.