Hi! I'm having some problems creating a shadow raycast library.
The raycast is working perfectly
But when I try to draw the shadow polygon it looks like the love.graphics.polygon is sort of "jumping" some of the points of the raycast
If the polygon is a triangle fan, its first point must be in its center (i.e. where rays start), otherwise overlapping will occur, as seen on your image.
raidho36 wrote:If the polygon is a triangle fan, its first point must be in its center (i.e. where rays start), otherwise overlapping will occur, as seen on your image.
And the Polygon must be "simple". There's a love.math function to tesselate complex polygons into multiple simple ones i believe.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Btw, it's not a triangle fan, I sort the angles and then make the polygon with the intersections. The first point in the center actually kind of worked! but there is a gap between 2 points. I also tryed to initialize the polygon points table with the last intersection but the overlap come back
I guess technically you're generating a triangle fan, but you're drawing a polygon.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim