This is a simple raycaster!
It might sometimes freeze for a few seconds. This sometimes happens when the player is sliding against a wall. Thanks to @griffpatch for the raycasting tutorial.