-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polygon collision detection returns false #45
Comments
I created an sample: All circles in the polygon should be red, all outside green. |
This sandbox shows the issue: The convex polygons are not calculated correctly. |
I've checked the curious case this happens because your polygon not only is a non convex polygon, it is not a simple polygon - it has lines that cross each other @tmanninger simple fix |
feel free to open an issue here https://github.com/schteppe/poly-decomp.js/issues I guess I've checked that see https://codesandbox.io/s/pedantic-haze-zxg8me?file=/src/App.tsx:596-895 logs the table
|
@tmanninger closing as this won't fix on the side of detect-collisions, it might get fixed in poly-decomp, or you can just round your points. good luck |
Thanks for feedback @Prozi
This worke fine. |
hello @tmanninger approximation of aInB and bInA has been hopefully fixed/featured correctly since v6.8.0 please see https://codesandbox.io/s/detect-collisions-test3-forked-gxfjzp?file=/package.json could you test this a bit on your cases? |
Hi,
i have the following polygon:
I check collision on the red point, but it returns false.
My polygon:
Points of the polygon are set with:
new Polygon({x: 0, y: 0}, points)
I check the collision of the point: x: 662.8325216009875, y: 262.71592654331613 and should detect a collision (
let candidate = new Point({x: x, y: y}
))The collision will be checked with: system.checkCollisionCanditate(Polygon, Point)
Is this the correct way?
Thanks for help!
The text was updated successfully, but these errors were encountered: