One of the first assignments on the first Java course on my computing science program was to create a program with bouncing balls. The balls should be able to bounce of the walls. There was no requirement for the balls to bounce of each other.
Is there a simple model for bouncing two balls? One approach is to only look at one ball at a time and consider the other ball as a rigid object. The in angle should be the same as the out angle:
The result: a very simple ball simulation program:
There are of course some bugs. Like that the balls can escape... :) Try it out! If the balls get stuck drag them into a new position. Balls version 0.0.1
Post a Comment