Pretty simple, input how many balls you want. Set a speed... watch it bounce... Please report any bugs, I'm fairly sure there are some. Also please make any suggestions to make it smoother/work better, etc. The logic of this is actually quite interesting, for those curious among you. The main task is when the ball is touching a surface, figuring out the angle of the surface at that point, the rest is just reflecting an angle, which isn't so tough. What I did was I created a bunch of points, at various angles, distributed around the perimeter of the ball, a little farther out from the perimeter. When the ball touches the surface, I analyze the angles of all the points that are touching the surface, and average them. This is roughly the angle perpendicular to the surface. A flaw is that this requires the surface being symmetrical meaning the ball can only reflect off lines and circles currently, which is good enough for most of my purposes, but will face challenges in general use. If you have a fix for this please comment below
100% by me credit @sppurpleeagle02 (my main) if you want to use This might be used in some game I'll be making.