Raycaster

Visualizing 3D scenes with raycasting and trignometry

TECHNOLOGIES

I really wanted to explore raycasting and some of the math behind it. So, I created this raycasting sandbox to experiment with it. On the left half of the screen, I have a top-down 2D view of the map with rays being casted from the player. On the right half, I implemented a 3D view of the scene using the euclidean distances I got from raycasting. The euclidean distances returned are converted to perpendicular distances with a bit of trignometry to get a less distorted image of the 3D space.

Using this much trignometry was quite fun, but it would have been easier to implement the caster with less of it it. To calculate the distance, we really only need to know how much the length of the ray increases whenever one of the components increases by 1. We can use this fact by determining which side the intersection occurs on, and, then, use the corresponding component. This might help reduce floating point errors.

This was my first 'major' project using Golang, and it's quite enjoyable. I'm hoping the game development ecosystem for it grows.