-
Notifications
You must be signed in to change notification settings - Fork 299
collidePointPoint()
Ben Moren edited this page Jun 5, 2021
·
1 revision
Point to point collision with an optional buffer zone.
var hit = false;
function draw() {
background(255);
circle(100, 100, 1); // change to 10,10px size for buffer example
circle(mouseX, mouseY, 1); // change to 10,10px size for buffer example
// No buffer zone, most standard example:
hit = collidePointPoint(100, 100, mouseX, mouseY);
// Buffer of 10 px:
// hit = collidePointPoint(100, 100, mouseX, mouseY, 10);
// Use vectors as input:
// const p1 = createVector(100, 100);
// const mouse = createVector(mouseX, mouseY);
// hit = collidePointPointVector(p1, mouse, 10);
stroke(hit ? color('red') : 0);
print('colliding?', hit);
}
- collidePointPoint()
- collidePointCircle()
- collidePointEllipse()
- collidePointRect()
- collidePointLine()
- collidePointArc()
- collideRectRect()
- collideCircleCircle()
- collideRectCircle()
- collideLineLine()
- collideLineCircle()
- collideLineRect()
- collidePointPoly()
- collideCirclePoly()
- collideRectPoly()
- collideLinePoly()
- collidePolyPoly()
- collidePointTriangle()
- collide 2D primitive triangle