Java 2D Physics Engine Source Code

Check out the source code for the Java 2D Physics Engine on


I initially started writing code for the purpose of tying together my knowledge on topics I learned throughout this semester in my Computer Science class. As I programmed, I continued to add more and more functionality until I just decided to thumb through my Physics textbook and just make a simple 2D physics simulation.

Continue reading


Java 2D Physics Engine (16 hrs)

Okay, so I had a jacked up collision detection algorithm, and I pretty much rewrote the entire algorithm. Here it is in much more accurate form. Also changed from images of balls to just straight up circles, which allows me to easily change the diameter at will. Video below.

Continue reading

Java 2D Physics Engine (9 hrs)

Yesterday, I started coding a small project in Java, with the intent of practicing some of the techniques I’ve learned in my CS class this semester (swing, threads, etc). It started out small, but every step of the way, I wanted to add something more. Before long, I had kinematic equations and gravity. Now, object collision detection. Granted, all of it needs improvement and polishing, but for a day’s work, I’m pretty happy. Video after the jump.

Continue reading