CollisionDetection
CollisionDetection copied to clipboard
polyPoly flawed
I haven't really looked into the details, but playing around with the online version, sometimes when the small polygon is fully inside the larger one, a collision is not detected.
Also, maybe related, you run the following code inside the for-loop, which doesn't make much sense, since it doesn't depend on any of the looped vars, only function parameters:
// optional: check if the 2nd polygon is INSIDE the first
collision = polyPoint(p1, p2[0].x, p2[0].y);
if (collision) return true;
(maybe you wanted to iterate over the vertices of p2?)
Sorry, I know this issue is super old now! I can't seem to make this happen – would you mind trying to replicate the issue and record a short video?
I am not sure how to record a video. It seems easier to reproduce the bug on a smartphone. The polygon blinks blue as you drag the shape around.
Didn't intend to close ticket, always hit the wrong button. (Although feel free to close if you can't repro)
No worry! I'll take a look on my phone and see if it's a problem for me too.