What is a physics simulation engine?

A physics simulation engine is a custom software engine that grants developers add visual effetcs, simulate and tweak objects and enviroments accroding to the law of physics in 2D, 3D or both.

With physics engine software, developers and artists apply real-world physical properties, such as gravity and momentum, to their 2D and 3D objects rather than designing them from scratch.

In contast it offers the tools for developers to add simulation of certain physical systems, such as rigid body dynamics

Applications

  1. Game development
  2. Mechatronics
  3. Off-road vehicle mobility
  4. Terramechanics
  5. Virtual reality
  6. Granular flows
  7. Collision detection
  8. Autonomous vehicles
  9. Seismic engineering
  10. Augmented reality
  11. Robotics
  12. Wheeled vehicle dynamics
  13. Tracked vehicle dynamics
  14. Nonlinear finite element analysis

In this article, we offer the best open-source pyhsics SDKs, libraries and frameworks for developers.

1- Project Chrono

Project Chrono is a free, open-source multipurpose multi-physics simulation engine which is written in C++ and comes with a Python version.

Project Chrono can be used as the primary physics engine for virtual reality projects, mechanical simulation, car simulation, collision detection, augmented reality, and robotics simulation projects.

Project Chrono is licensed under the BSD-3-Clause license.

Project Chrono Features

  • Multibody dynamics
  • Finite elements
  • Vehicle dynmics
  • Large scale simulation
  • Collision detection
  • C++ and Python version
  • Granular dynamics
  • Co-simulation
  • Fluid-solid interaction
  • Post-processing
  • Fluid-solid interaction
  • Multicore support
  • Built-in GPU support
  • Works on Windows, Linux, and macOS.

2- ReactPhysics3D

ReactPhysics3D is a C++ physics engine library that can be used in 3D simulations and games. The library is developed by Daniel Chappuis and is released under the open-source ZLib license.

ReactPhysics3D Features

  • Rigid body dynamics
  • Discrete collision detection
  • Collision shapes (Sphere, Box, Capsule, Convex Mesh, Static Concave Mesh, Height Field)
  • Multiple collision shapes per body
  • Broadphase collision detection (Dynamic AABB tree)
  • Narrowphase collision detection (SAT/GJK)
  • Collision response and friction (Sequential Impulses Solver)
  • Joints (Ball and Socket, Hinge, Slider, Fixed)
  • Collision filtering with categories
  • Ray casting
  • Sleeping technique for inactive bodies
  • Multi-platform (Windows, Linux, Mac OS X)
  • No external libraries (do not use STL containers)
  • Documentation (user manual and Doxygen API)
  • Testbed application with demos
  • Integrated Profiler
  • Debugging Renderer
  • Logs
  • Unit tests

3- Open Dynamics Engine (ODE)

ODE or Open Dynamics Engine is an open-source, high performance library for simulating rigid body dynamics. It is fully featured, stable, mature and platform independent with an easy to use C/C++ API. It has advanced joint types and integrated collision detection with friction.

ODE is useful for simulating vehicles, objects in virtual reality environments and virtual creatures. It is currently used in many computer games, 3D authoring tools and simulation tools.

ODE is an open-source project released under the BSD License.

4- qu3e

The qu3e engine  is a compact, light-weight and fast 3D physics engine in C and C++. It is specifically created to be used in games, but it can be used for other simulations as virtual reality, and mechanical simulation.

It is portable with no external dependencies other than various standard c header files (such as cassert and cmath). The qu3e engine is designed to have an extremely simple interface for creating and manipulating rigid bodies.

qu3e features

  • Extremely simple and friendly to use API
  • 3D Oriented Bounding Box (OBB) collision detection and resolution
  • Discrete collision detection
  • 3D Raycasting into the world (see RayPush.h in the demo for example usage)
  • Ability to query the world with AABBs and points
  • Callbacks for collision events
  • Sensors (collision volumes)
  • Ability to create an aggregate rigid body composed of any number of boxes
  • Box stacking
  • Islanding and sleeping for CPU optimization
  • Renderer agnostic debug drawing interface
  • Dynamic AABB tree broad phase
  • Highly accurate collision manifold generation via the Separating Axis Theorem
  • Collision layers
  • Axis of rotation locking (x, y or z axes)
  • Modifiable q3Alloc and q3Free functions for custom memory allocation
  • Internal heaps and dynamic arrays for memory management, uses q3Alloc/q3Free
  • Scene dump -- Can output a log file of C++ code to re-create a physics scene

5- Bullet Physics SDK and PyBullet

Bullet Physics SDK is an open-source real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc. It is written in C++, but it offers a Python port as well.

6- Kubric PyBullet

Kubric is an open-source Python framework that interfaces with PyBullet and Blender to generate photo-realistic scenes, with rich annotations, and seamlessly scales to large jobs distributed over thousands of machines, and generating TBs of data.

Kubric can generate semi-realistic synthetic multi-object videos with rich annotations such as instance segmentation masks, depth maps, and optical flow.

7- Chipmunk2D

Chipmunk2D is a simple, lightweight, fast and portable 2D rigid body physics library written in C. It’s licensed under the unrestrictive, OSI approved MIT license.

Hundreds of shipping games have chosen Chipmunk because of the high quality, speed, and accuracy of its 2D physics simulations.

It works seamlessly on Windows, Linux, macOS, Android, and iOS. The new version is built to work on the ARM NEON.

Chipmunke2D Features

  • Designed specifically for 2D video games.
  • Circle, convex polygon, and beveled line segment collision primitives.
  • Multiple collision primitives can be attached to a single rigid body.
  • Fast broad phase collision detection by using a bounding box tree with great temporal coherence or a spatial hash.
  • Extremely fast impulse solving by utilizing Erin Catto’s contact persistence algorithm.
  • Supports sleeping objects that have come to rest to reduce the CPU load.
  • Support for collision event callbacks based on user definable object types types.
  • Flexible collision filtering system with layers, exclusion groups and callbacks.
  • Can be used to create all sorts of effects like one way platforms or buoyancy areas. (Examples included)
  • Supports nearest point, segment (raycasting), shape and bounding box queries to the collision detection system.
  • Collision impulses amounts can be retrieved for gameplay effects, sound effects, etc.
  • Large variety of joints – easily make vehicles, ragdolls, and more.
  • Joint callbacks.
  • Can be used to easily implement breakable or animated joints. (Examples included)
  • Maintains a contact graph of all colliding objects.
  • Lightweight C99 implementation with no external dependencies outside of the Std. C library.
  • Many language bindings available.
  • Simple, read the documentation and see!
  • Unrestrictive MIT license

8- Box2D

Box2D is a free open-source 2D physics game engine that written in C++. It is an ideal engine for developers who want to build a 2D game with complex 2D physics system.

Box2D comes with special instructions for Xcode developers and a rich developer-friendly documentation.

Box2D is an open-source project released under the MIT license.

Box2D features

  • Continuous physics with time of impact solver
  • Persistent body-joint-contact graph
  • Island solution and sleep management
  • Contact, friction, and restitution
  • Stable stacking with a linear-time solver
  • Revolute, prismatic, distance, pulley, gear, mouse joint, and other joint types
  • Joint limits, motors, and friction
  • Momentum decoupled position correction
  • Fairly accurate reaction forces/impulses
  • Continuous collision detection
  • Contact callbacks: begin, end, pre-solve, post-solve
  • Convex polygons and circles
  • Multiple shapes per body
  • One-shot contact manifolds
  • Dynamic tree broadphase
  • Efficient pair management
  • Fast broadphase AABB queries
  • Collision groups and categories
  • Small block and stack allocators
  • Centralized tuning parameters
  • Highly portable C++ with no use of STL containers

9- PhysX

PhysX is a scalable multi-platform physics solution supporting a wide range of devices, from smartphones to high-end multicore CPUs and GPUs.

PhysX is already integrated into some of the most popular game engines, including Unreal Engine, and Unity3D.

It is developed and released by NVIDIA. It can work on Windows, Linux, macOS, iOS, and Google Android ARM.

10- Jolt Physics

The Jolt Physics engine is a multicore friendly rigid body physics and collision detection library suitable for games and VR applications, used by Horizon Forbidden West.

It works smoothly on Windows, Linux, Android, macOS, iOS, and x64 supported game consoles.

Jolt Physics is written in C++ and released as an open-source project under the MIT License.
Jolt Physics Features

  • Collision detection for many shapes: sphere, box, capsule, tapered-capsule, cylinder, convex hull, compound, mesh (triangle), and terrain (height field).
  • Simulation of constraints bodies
  • Comes with a rich configurable sensors
  • Game characters simulation
  • Vehicle simulation
  • Water buoyancy calculation
  • Animated ragdolls simulation

11- bepuphysics

The bepuphysics engine is an open-source 3D real time physics simulation library that is written in C# programming language.

The project is released under the Apache-2.0 License.

bepuphysics features

  • Multiple shapes support: spheres, capsules, boxes, triangles, cylinders, and convex hulls
  • Collision detection
  • Compounds of the above
  • Meshes
  • A whole bunch of constraint types
  • Newts
  • Linear and angular continuous collision detection
  • Extremely low cost sleep states for resting bodies
  • Efficient scene-wide ray and sweep queries
  • Character controller samples
  • At least somewhat extensible collision pipeline, with example custom voxel collidable
  • Highly nonidiomatic APIs
  • Super speediness
  • And a bunch of other miscellaneous stuff!

12- Brax

Brax is a differentiable physics' engine that simulates environments made up of rigid bodies, joints, and actuators.

Brax is written in JAX and is designed for use on acceleration hardware. It is both efficient for single-device simulation, and scalable to massively parallel simulation on multiple devices, without the need for pesky datacenters.

It is an open-source project, released under the Apache-2.0 License.

13- MuJoCo

MuJoCo is a free and open source physics engine that aims to facilitate research and development in robotics, biomechanics, graphics and animation, and other areas where fast and accurate simulation is needed.


MuJoCo

  • Simulation in generalized coordinates, avoiding joint violations
  • Inverse dynamics that are well-defined even in the presence of contacts
  • Unified continuous-time formulation of constraints via convex optimization
  • Constraints include soft contacts, limits, dry friction, equality constraints
  • Simulation of particle systems, cloth, rope and soft objects
  • Actuators including motors, cylinders, muscles, tendons, slider-cranks
  • Choice of Newton, Conjugate Gradient, or Projected Gauss-Seidel solvers
  • Choice of pyramidal or elliptic friction cones, dense or sparse Jacobians
  • Choice of Euler or Runge-Kutta numerical integrators
  • Multi-threaded sampling and finite-difference approximations
  • Intuitive XML model format (called MJCF) and built-in model compiler
  • Cross-platform GUI with interactive 3D visualization in OpenGL
  • Run-time module written in ANSI C and hand-tuned for performance

14- dyn4j

The dyn4j engine is Java 2D collision detection and physics engine. Designed to be fast, stable, extensible, and easy to use. dyn4j is free for use in commercial and non-commercial applications.


The project is released under the BSD-3-Clause license at GitHub.

15- Matter.js

Matter.js is a Java-Script web-ready 2D physics engine, that is tested on all popular web browsers like Google Chrome, Mozilla Firefox, Opera, and Microsoft Edge.

Matter.js comes with a rich library of sample simulation projects, plugins, and demos.

It is an open-source project released under the MIT License.

Matter.js features

  • Rigid bodies
  • Compound bodies
  • Composite bodies
  • Concave and convex hulls
  • Physical properties (mass, area, density etc.)
  • Restitution (elastic and inelastic collisions)
  • Collisions (broad-phase, mid-phase and narrow-phase)
  • Stable stacking and resting
  • Conservation of momentum
  • Friction and resistance
  • Events
  • Constraints
  • Gravity
  • Sleeping and static bodies
  • Plugins
  • Rounded corners (chamfering)
  • Views (translate, zoom)
  • Collision queries (raycasting, region tests)
  • Time scaling (slow-mo, speed-up)
  • Canvas renderer (supports vectors and textures)
  • MatterTools for creating, testing and debugging worlds
  • World state serialisation (requires resurrect.js)
  • Cross-browser and Node.js support (Chrome, Firefox, Safari, IE8+)
  • Mobile-compatible (touch, responsive)
  • An original JavaScript physics implementation (not a port)

16- ODE4J

ode4j is a Java port of the ODE or Open Dynamics Engine.

Same as ODE, it has advanced joint types and integrated collision detection with friction. ode4j is useful for 3D rigid body physics simulations, such as simulating vehicles, objects in virtual reality environments and virtual creatures. In addition to ODE functionality, ode4j also has a special rag doll type.

Documentation on how to get started is available on the wiki and in numerous demos. The main technical documentation is the ODE wiki.

ode4j is an open-source project released under the BSD License.




End-note

As our post came to an end, we listed the varies pyhsics engines for building games, virtual reality apps, or any simulation project.

If you know of any similar project that we didn't mention here, let us know.