Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Build Status DUB Package License


dmech stands for "D mechanics": it is a real-time 3D physics engine written in D language, capable of simulating rigid body dynamics. It is more suitable for computer games than scientific simulations: the goal is to convince a player, rather than giving accurate results. dmech is GC-free and fully platform-independent, it can be used with any API or graphics engine.

If you like dmech, please support its development on Patreon. You can also make one-time donation via PayPal. I appreciate any support. Thanks in advance!


Screenshot1 Screenshot2 Screenshot3


  • Impulse-based rigid body dynamics with iterative SI solver
  • High-performance collision detection (MPR algorithm)
  • Basic geometry shapes (sphere, box, cylinder, cone, ellipsoid)
  • Support for any convex shape defined by support mapping
  • Multiple geometries per body
  • Arbitrary static trimeshes (collision detection is optimized via BVH)
  • Body constraints: distance, angular, slider, ball-socket, prismatic, hinge
  • Persistent contact cache
  • Ray cast support
  • Ownership-based memory management
  • Partial C API (will be finished soon)

Planned in future:

  • More shapes (capsule, plane, convex hull, etc.)
  • Minkowski sum shape
  • Force fields
  • Convex cast
  • In long-term: vehicle engine, particles, soft-body physics, OpenCL support


dmech heavily relies on dlib - a collection of utility libraries for D, including linear math and computational geometry functionality.


See tutorials.

Usage examples

You can find some simple examples in demos directory.

More advanced, real-world usage examples are Dagon demo application which features vehicle physics and provides better graphics and interesting user interaction, and Atrium, an in-development physics based action game.


Copyright (c) 2013-2020 Timur Gafarov. Distributed under the Boost Software License, Version 1.0. (See accompanying file COPYING or at

You can’t perform that action at this time.