Skip to content

Commit

Permalink
small change
Browse files Browse the repository at this point in the history
  • Loading branch information
Eyal Perry committed Sep 27, 2024
1 parent 82b2cd9 commit f01386c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit f01386c

Please sign in to comment.