Trying to make a raycaster
Posted: Sun Jul 31, 2016 9:36 am
I decided to make a raycaster, but it doesn't look like any other raycaster there is. And I kind of expected it to be like that, I don't know how other raycasters do it.
So how does mine work? It sends out rays from the player's position, and then it checks each one. If a ray hit something, it's gonna draw a rectangle with a height depending on the length of said ray.
Usually in 3d games (raycasting or not), when you stand in front of a straight wall, it's gonna look straight, right? Well, in my case, it's not. Because rays are sent out around the player - the closer a ray is to the center of the screen, the more curved the wall is going to appear. Looks weird, right?
How do other raycasters work? And how can I fix mine? Thanks in advance!
So how does mine work? It sends out rays from the player's position, and then it checks each one. If a ray hit something, it's gonna draw a rectangle with a height depending on the length of said ray.
Usually in 3d games (raycasting or not), when you stand in front of a straight wall, it's gonna look straight, right? Well, in my case, it's not. Because rays are sent out around the player - the closer a ray is to the center of the screen, the more curved the wall is going to appear. Looks weird, right?
How do other raycasters work? And how can I fix mine? Thanks in advance!