slembcke/Chipmunk2D logo

slembcke/Chipmunk2D

Free

A fast and lightweight 2D game physics library.

FreeFree tier
Type
Open Source

About slembcke/Chipmunk2D

Chipmunk2D is a simple, lightweight, fast and portable 2D rigid body physics library written in C. Designed specifically for 2D video games, it offers a full suite of physics features including circle, convex polygon, and beveled line segment collision primitives, fast broad phase collision detection via bounding box tree or spatial hash, impulse solving using Erin Catto's contact persistence algorithm, sleeping objects for CPU efficiency, collision callbacks, flexible filtering, nearest point/segment/shape queries, a variety of joints (with joint callbacks for breakable/animated joints), and a contact graph. The library is C99 with no external dependencies, licensed under the MIT license, and has many language bindings available. Version 7 adds ARM NEON optimizations, autogeometry code, and a multithreaded solver.

Key Features

Designed specifically for 2D video games
Circle, convex polygon, and beveled line segment collision primitives
Multiple collision primitives per rigid body
Fast broad phase collision detection (bounding box tree or spatial hash)
Impulse solving using Erin Catto's contact persistence algorithm
Sleeping objects to reduce CPU load
Collision event callbacks based on user-defined object types
Flexible collision filtering with layers, exclusion groups, and callbacks
Nearest point, segment (raycasting), shape, and bounding box queries
Retrieve collision impulse amounts for gameplay effects

Pros & Cons

Pros
  • Fast and lightweight with no external dependencies
  • MIT license allows free use in commercial projects
  • Rich feature set including joints, sleeping, queries, and callbacks
  • Many language bindings available for easy integration
  • Cross-platform portable C code
  • Active development with recent optimizations (ARM NEON, multithreading)
Cons
  • 2D only, not suitable for 3D physics
  • C library may require wrappers for other languages
  • No built-in graphics or audio; physics only

Best For

2D video game physics simulationPrototyping and indie game developmentPhysics-based puzzles and platformersEducational projects for learning game physics

FAQ

What license does Chipmunk2D use?
Chipmunk2D is licensed under the unrestrictive, OSI approved MIT license.
Is Chipmunk2D cross-platform?
Yes, it is written in portable C99 and works on multiple platforms including Windows, macOS, Linux, Android, and iOS.
Does Chipmunk2D support collision detection?
Yes, it supports circle, convex polygon, and beveled line segment primitives with broad phase detection using a bounding box tree or spatial hash.
Are there language bindings available?
Yes, many language bindings are available for Chipmunk2D.
What is new in Chipmunk 7?
Chipmunk 7 includes ARM NEON optimizations, autogeometry code, and a multithreaded solver.