
Box2D
A 2D Physics Engine for Games. Box2D. A 2D Physics Engine for Games © 2025 Erin Catto
Overview - Box2D
Box2D is a 2D rigid body simulation library for games. Programmers can use it in their games to make objects move in realistic ways and make the game world more interactive. From the game engine's point of view, a physics engine is just a system for procedural animation.
Box2D: Overview
Box2D is a 2D rigid body simulation library for games. Programmers can use it in their games to make objects move in realistic ways and make the game world more interactive. From the game engine's point of view, a physics engine is just a system for procedural animation.
Box2D: Simulation
The AABB overlap is very fast but not very accurate because it only considers the shape bounding box. If you want an accurate overlap test, you can use a shape overlap query. For example, here is how you can get all shapes that overlap with a query circle.
About - Box2D
Hello! I’m Erin Catto. I work in the video game industry. I also created Box2D, a 2D physics engine for games. I use this blog to give updates on Box2D and write about game physics and programming. You can find Box2D on GitHub; There is a Discord Server; And there is a Subreddit; This site was created using Hugo and a modified version of ...
Samples - Box2D
The samples application has many examples of Box2D usage in the test cases and the framework itself. I encourage you to explore and tinker with the samples as you learn Box2D.
Collision - Box2D
In many cases a game environment is constructed by connecting several segment shapes end-to-end. This can give rise to an unexpected artifact when a polygon slides along the chain of segments. In the figure below there is a box colliding with an internal vertex.
Box2D: Hello Box2D
In the distribution of Box2D is a Hello World unit test written in C. The test creates a large ground box and a small dynamic box. This code does not contain any graphics. All you will see is text output in the console of the box's position over time. This is a good example of how to get up and running with Box2D. Creating a World
Publications - Box2D
Box2D v3 Benchmarks Benchmarks Dynamic Bounding Volume Hierarchies — GDC 2019 GDC Slides Full Slides Numerical Methods — GDC 2015 Slides Understanding Constraints — GDC 2014 Slides Matlab Source YouTube Continuous Collision — GDC 2013 Slides YouTube Ragdolls — GDC 2012 Slides Soft Constraints — GDC 2011 Slides Computing Distance using GJK — GDC 2010 Slides Source Numerical ...
Box2D: Shape
Data Fields; uint32_t: customColor: Custom debug draw color. float: density: The density, usually in kg/m^2. bool: enableContactEvents: Enable contact events for this ...