Log In  

Cart #bjk_rays-3 | 2019-10-11 | Code ▽ | Embed ▽ | No License

Playing with raycasting. By default: top down flashlight simulator. Hit Z to go 3D instead!

X will loop through FOV settings, toggle between top down and 3D to visualise what's going on.

UPDATE: Now with zooming effect

P#68716 2019-10-10 11:47 ( Edited 2019-10-11 08:38)

Very cool prototype! Good job!

P#68717 2019-10-10 12:02

Very impressive.

After wandering around this I typed in raycasting to the BBS search, and there are about a page worth of implementations in the search results to wander around, some of them developed as far as games.


P#68753 2019-10-11 06:46 ( Edited 2019-10-11 06:47)


Yeah, there's a lot of very impressive ones in progress on the Discord as well. I'm sharing this because it helped me make sense of how it works, I had an idea for a flashlight mechanic and someone suggested using raycasting to draw the beam. Took me forever to get the maths right, but I was chuffed when it worked.

Only much later did I realise I kind of had a 3D engine already; instead of drawing beams going out from a point of length X, I just had to draw vertical lines on the screen for each beam, with a length inversely proportional to the length of the beam. Took literally 7 lines of code to go from flashlight to 3D! :p

P#68754 2019-10-11 06:54

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-05-31 20:46 | 0.017s | 4194k | Q:32