I want to solve some collisions I want to do this by looping through all objects get the first one and after that loop over all objects again ( The nested loop ) en get in the second loop the second object and do the collision detection solving this is the code I got it may clarify what I mean
fn solve_collision(&mut self) {
let object_count = self.blobs.len();
for i in 0..object_count {
let first = &mut self.blobs[i];
for j in 0..object_count {
if i == j {
continue;
};
let second = &mut self.blobs[j];
first.update_collision(second)
}
}
}
self.blobs is just a vector with the objects
update_collision() is not written yet