Log In  

Cart [#bjk_rays-3#] | Code | 2019-10-11 | No License | Embed
4

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)
1

Thanks!

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]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-10-20 09:40 | 0.019s | 4194k | Q:26