Basic Raycasting Demo

Published 2023-06-12


Controls:

After trying to make raycasting the wrong way, I came up with this method.
I really don't know if thats the correct way of doing it. My idea was to have rays being shot from the player, when they hit a wall the stop and draw a line in the center at the screen + index of the ray, also the further away the ray went, the smaller the line will be. So that make a pretty good illusion of 3d in a 2d space. You can poke around with the values like the field of vision, amount of samples taken (rays shot), the stretch of the screen and many other.

But I am having this fisheye issue. I guess you noticed that the prespectiv isn't always correct. sometimes it gets this weird round edges. I dont really know how to fix that. Also I dont know how to have walls with diffrent colors, or have a wall which is red on the left side a dark red on the right.