AB3: BodyLinkedList working
This commit is contained in:
@ -81,7 +81,7 @@ public class Simulation {
|
||||
// merge bodies that have collided
|
||||
for (int i = 0; i < bodies.length; i++) {
|
||||
for (int j = i + 1; j < bodies.length; j++) {
|
||||
if (bodies[j].distanceTo(bodies[i]) < bodies[j].radius() + bodies[i].radius()) {
|
||||
if (bodies[j].collidesWith(bodies[i])) {
|
||||
bodies[i] = bodies[i].merge(bodies[j]);
|
||||
Body[] bodiesOneRemoved = new Body[bodies.length - 1];
|
||||
for (int k = 0; k < bodiesOneRemoved.length; k++) {
|
||||
|
Reference in New Issue
Block a user