Page 1 of 1
Small Ray Tracing (or RayCasting)
Posted: Sun Nov 22, 2020 5:17 pm
by darkfrei
Hi all!
I've made small tool: it checks where is the first nearest point on the line (
https://love2d.org/wiki/love.graphics.line) from given ray source.
Re: Small ray tracing
Posted: Wed Nov 25, 2020 8:36 pm
by darkfrei
My implementation ray tracing as a lib;
Please help me to fix it, I'm bad with objects. If possible, without metatables, I cannot understand them.
Re: Small ray tracing
Posted: Wed Dec 02, 2020 2:51 pm
by noahnadai
Where were you three months ago when my game needed you? Good work!
Re: Small ray tracing
Posted: Wed Dec 02, 2020 10:40 pm
by darkfrei
noahnadai wrote: ↑Wed Dec 02, 2020 2:51 pm
Where were you three months ago when my game needed you? Good work!
I need that tool for my project too, that's why I wrote that.
Where are you need it?
Re: Small ray tracing
Posted: Thu Dec 03, 2020 6:16 am
by noahnadai
darkfrei wrote: ↑Wed Dec 02, 2020 10:40 pm
noahnadai wrote: ↑Wed Dec 02, 2020 2:51 pm
Where were you three months ago when my game needed you? Good work!
I need that tool for my project too, that's why I wrote that.
Where are you need it?
This game I recently finished. Had to manually assign co-ordinates for each laser and it's respective collision point.
https://mwasanje.itch.io/the-squarehouse
Re: Small ray tracing
Posted: Wed Dec 23, 2020 3:34 pm
by darkfrei
Re: Small ray tracing
Posted: Mon Jan 04, 2021 10:19 am
by lucked
Well done!
Re: Small Ray Tracing (or RayCasting)
Posted: Mon Feb 21, 2022 10:45 am
by togFox
Trying to adapt rays.lua into my own project. The example here has two lines - line1 and line2 as two distinct lines. I have about 50 lines (all about 50 pixels short) so would like to adapt to call a table of lines ... I guess.
I have a line defined, not surprisingly, as x1,y1,x2,y2. So, I guess I might have:
line[1] = x1,y1,x2,y2
line[2] = x1,y1,x2,y2 -- different values for x1,y1,x2,y2
line[3] = x1,y1,x2,y2 -- different values for x1,y1,x2,y2
line[4] = x1,y1,x2,y2 -- different values for x1,y1,x2,y2
They are not continuous like in the example in this thread. They all have exactly two xy pairs - but - I have an undefined number of lines. How to adjust rays.lua?
Re: Small Ray Tracing (or RayCasting)
Posted: Mon Feb 21, 2022 11:15 am
by darkfrei
togFox wrote: ↑Mon Feb 21, 2022 10:45 am
Maybe table required?