Hi, I’m trying to see if my mouse is inside a shape with the PGS library.
There’s maybe something wrong, I’ve got sometimes “ok” in the console.
Here’s my code :
import micycle.pgs.*;
PShape sh;
void setup() {
sh = createShape();
sh.beginShape();
sh.vertex(20, 20);
sh.vertex(90, 40);
sh.vertex(40, 90);
sh.vertex(20, 20);
sh.endShape();
}
void draw() {
background(128);
shape(sh);
if (PGS_ShapePredicates.containsPoint(sh, new PVector(mouseX, mouseY))) print("ok");
}
Thanks