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
Here's the code:
https://github.com/Alucherdi/Love2d-sha ... ee/develop
I hope you can help me with my problem, feel free to ask any question, I'll answer as soon as possible. Thanks!
[Solved!] Shadow raycast polygon fail (Help!)
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[Solved!] Shadow raycast polygon fail (Help!)
Last edited by alucherdi on Thu Nov 10, 2016 10:49 pm, edited 1 time in total.
Re: Shadow raycast polygon fail (Help!)
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.
Re: Shadow raycast polygon fail (Help!)
And the Polygon must be "simple". There's a love.math function to tesselate complex polygons into multiple simple ones i believe.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.
Re: Shadow raycast polygon fail (Help!)
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
Re: Shadow raycast polygon fail (Help!)
It's not gonna be needed for this particular use, since it generates perfectly good triangle fans as it is.
Re: Shadow raycast polygon fail (Help!)
Ok ok let me do some test with that information
Re: Shadow raycast polygon fail (Help!)
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
Re: Shadow raycast polygon fail (Help!)
You just add that point again so that the triangle fan closes.
Also yes it is most definitely a triangle fan.
Also yes it is most definitely a triangle fan.
Re: Shadow raycast polygon fail (Help!)
It's not!, when I draw the polygon the points that intersects don't return to the origin uwu, and it worked! thanks a lot!!
Thanks a lot, I'm pushing in git with the results
Thanks a lot, I'm pushing in git with the results
Re: [Solved!] Shadow raycast polygon fail (Help!)
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
Who is online
Users browsing this forum: Bing [Bot] and 4 guests