JAVA COLLISION DETECTION AND PHYSICS ENGINE

A 100% 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

Download

Download

dyn4j is a maven project but can be used in non-maven projects. It supports OSGI and Java 9 modules and is built against Java 1.6. dyn4j has no dependencies.
Maven
<dependency>
    <groupId>org.dyn4j</groupId>
    <artifactId>dyn4j</artifactId>
    <version>5.0.2</version>
</dependency>
Other ways to download:
GitHub Packages   Releases (legacy)

100% Java

Written entirely in Java with zero dependencies running on Java 1.6 or higher.

Tested

Over 2,000 automated JUnit tests, suite of samples, and Sandbox GUI application.

Documented

Getting started is easy with Javadocs, wiki, and more.

Open Source

Open source and free to use in commercial and non-commercial applications.

Take dyn4j for test drive

The sample repo contains a simple Java2D framework (and a JOGL example) along with a number of sample simulations.

View the samples

Getting started is simple

The easiest way to get started is to clone the dyn4j-samples repo locally as shown below.

You can also get started by downloading the latest version of the library, adding it to your project, and then taking a look at the UsingGraphics2D and UsingJogl sample applications. Check out the rest of the samples for additional help.

It's recommend to go through the getting started page first. If you do get stuck, take a look at the javadocs or start a discussion on GitHub.

Learn how to use dyn4j
View the latest Javadocs
Get help from the community
View the latest release notes

QUICK START GUIDE


A quick 2 minute video showing the use of the samples GitHub project to get started using dyn4j

If you'd like to learn more about how dyn4j works, check out the blog or read through the heavily documented source code on GitHub.

Latest Blog Posts

Version 5.0.2

This update focuses on a few minor performance improvements, fixes and enhancements.

Version 5.0.1

This update fixes a few issues discovered while enhancing the samples project. This update does change the behavior of the SolvedContact.isSolved method and removes the code that resets the enabled and tangentVelocity properties on the ContactConstraint.

Version 5.0.0

This major update overhauls the org.dyn4j.dynamics.joint package. This update allows the creation of new joints with an arbitrary number of bodies (whereas only one-body or two-body joints were possible before). This release sees all joints inherit from standard interfaces for things like limits, motors, and springs with the intent to make the API surface identical among all the joints.