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 applicationsDownload
Written entirely in Java with zero dependencies running on Java 1.6 or higher.
Over 2,000 automated JUnit tests, suite of samples, and Sandbox GUI application.
Getting started is easy with Javadocs, wiki, and more.
Open source and free to use in commercial and non-commercial applications.
The sample repo contains a simple Java2D framework (and a JOGL example) along with a number of sample simulations.
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.
A quick 2 minute video showing the use of the samples GitHub project to get started using dyn4j
When simulating physical interaction between objects, there are many tradeoffs used to keep performance acceptable for realtime scenarios. The geometry of an object, or it’s shape, is no exception. To accelerate calculations, collision detection systems will enforce rules about what types of shapes are supported - a key example is Convexity. Not all objects are convex, and you might even argue that most aren’t, but we can combine these convex pieces to create non-convex objects.
Version 4.0.0 had a lot of changes to the API to support better extensibility, testability, and maintainability, but the biggest change was the 30-40% improvement in performance. This type of of performance gain is huge and a boon for sure for all those using the library - but just how was it done?
In my last post where I talked about the reasons for moving the dyn4j site to GitHub Pages and off of WordPress, I mentioned another post to describe the technical details of the move - this is it! Seriously though, it wasn’t trivial, but that’s in part due to some self-imposed (inflicted?) constraints.