Skip to content

Commit bf35e74

Browse files
Merge branch 'master' into marii-newChanges
2 parents 591b36f + 8bbd090 commit bf35e74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/thealgorithms/physics/ElasticCollision2D.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void resolveCollision(Body a, Body b) {
4141
double dy = b.y - a.y;
4242
double dist = Math.hypot(dx, dy);
4343

44-
if (dist == 0) {
44+
if (dist < a.radius + b.radius) {
4545
return; // overlapping
4646
}
4747

0 commit comments

Comments
 (0)