-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
GetLineToPolygon doesn't work as expected #6467
Comments
I think I fixed the issue I had with GetLineToPolygon by changing the GetLineToPoints function. I replaced
by
So the intersection between the line and the segment composed with the first and the last point of the polygon is now checked. Here's the new codepen with my fix : |
Well I also confirm that there is no intersection between the line and the polygon when x1 = x2 on the line. I will try to investigate to find where is the issue (Codepen below) No intersection between the blue line or yellow line with the polygon here (green line intersection can be fixed with the changes I showed above): |
I feel a bit tired to talk alone as i posted that issue one week ago and that nobody answers.. But here's what I found.
Here's what I changed in the whole function GetLineToLine I replaced
by
Source : https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection To resume, I had a problem with the GetLineToPolygon function because of two errors:
Here's the pen with everything working normally (I hope) |
It seems you fixed one of the issues I mentioned in the Phaser 3.6 version and I can see it in the pen below. However, it seems that GetLinetoPolygon still not check all vertices in 3.6 (green line). |
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the |
Hello,
I don't know if it's a mistake from my side or not, but it seems that Phaser.Geom.Intersects.GetLineToPolygon does not work with the last vertice (the one which is not closed) of the polygon.
Here's an example
https://codepen.io/Abspirit/pen/PoyPNOK
the green dot is not supposed to be here or I did not get what it's supposed to do ?
And I also don't get why when I use the other "line4" (quoted in the example) it does not work.
(because X1 = X2 ?). I'm lost.
Thanks for your answer
The text was updated successfully, but these errors were encountered: