Planck.js
Planck.js is JavaScript/TypeScript rewrite of Box2D C++ physics engine for cross-platform game development.
Box2D
Box2D is a 2D rigid-body physics simulation library for games. You can use it in your 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.
Planck.js documentation is based on Box2D manual with adjustments and addition for JavaScript. Both projects names are used interchangeably in the documentation.
Before You Start
Planck.js is a physics engine, so to use the library you need to be familiar with basic physics concepts, such as mass, force, torque, and impulses. If not, you can ask ChatGPT to explain them.
Since Planck.js is written in JavaScript, you need to be familiar with JavaScript programming.
Running Your Code
Planck.js is a physics simulation library, and it doesn't draw anything.
Piqnt (opens in a new tab) is an online playground for Planck.js. You can explore examples (opens in a new tab), inspect and edit them, or create new ones.
Testbed is a simple tool (included in the project repository) to visualize and interact with physics simulation. Testbed is compatible with Piqnt playground.
You can use Planck.js with any game engines or frameworks, or use an existing integrations. See Rendering page for more information.