From f01386c07c4e2ef747419de7ccde96e54e14d2b7 Mon Sep 17 00:00:00 2001 From: Eyal Perry Date: Fri, 27 Sep 2024 10:38:04 -0400 Subject: [PATCH] small change --- docs/sketch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sketch.js b/docs/sketch.js index 0b266e1..83b0437 100644 --- a/docs/sketch.js +++ b/docs/sketch.js @@ -193,7 +193,7 @@ function checkIntersections() { let h = objects[i].h; - if (x > pyramidCenter && y < height - pyramidHeight / 2 && checkPositionRelativeToLine(x, y+h, rightLineX1, rightLineY1, rightLineX2, rightLineY2) >= 0) { + if (x > pyramidCenter && y + h / 2 < height - pyramidHeight / 2 && checkPositionRelativeToLine(x, y+h, rightLineX1, rightLineY1, rightLineX2, rightLineY2) >= 0) { // Normal to the line let normalVec = createVector(rightLineY2 - rightLineY1, rightLineX1 - rightLineX2).normalize(); // Perpendicular to the line @@ -203,7 +203,7 @@ function checkIntersections() { // Update the ball's velocity objects[i].v.set(reflection); - } else if (x < pyramidCenter && y < height - pyramidHeight / 2 && checkPositionRelativeToLine(x, y+h, leftLineX1, leftLineY1, leftLineX2, leftLineY2) < 0) { + } else if (x < pyramidCenter && y + h / 2 < height - pyramidHeight / 2 && checkPositionRelativeToLine(x, y+h, leftLineX1, leftLineY1, leftLineX2, leftLineY2) < 0) { // Normal to the line let normalVec = createVector(leftLineY2 - leftLineY1, leftLineX1 - leftLineX2).normalize(); // Perpendicular to the line