a slight fisheye effect is seen because line 30 of maze.c is
dir.y = -0.66;
instead of
dir.y = 0;
edit:
see https://lodev.org/cgtutor/raycasting.html, ie, "Make sure the camera plane is perpendicular to the direction, but you can change the length of it. The ratio between the length of the direction and the camera plane determinates the FOV, here the direction vector is a bit longer than the camera plane, so the FOV will be smaller than 90°"
in other words, if you change the initial direction (dir.x & dir.y), be sure to also change the initial camera plane (plane.x & plane.y) to be perpendicular to it
edit 2:
the above also reveals another small bug in input.c:
the line after /* rotate left */ should be if (keystate[SDL_SCANCODE_A])
the line after /* rotate right */ should be if (keystate[SDL_SCANCODE_D])
a slight fisheye effect is seen because line 30 of maze.c is
dir.y = -0.66;instead of
dir.y = 0;edit:
see https://lodev.org/cgtutor/raycasting.html, ie, "Make sure the camera plane is perpendicular to the direction, but you can change the length of it. The ratio between the length of the direction and the camera plane determinates the FOV, here the direction vector is a bit longer than the camera plane, so the FOV will be smaller than 90°"
in other words, if you change the initial direction (dir.x & dir.y), be sure to also change the initial camera plane (plane.x & plane.y) to be perpendicular to it
edit 2:
the above also reveals another small bug in input.c:
the line after
/* rotate left */should beif (keystate[SDL_SCANCODE_A])the line after
/* rotate right */should beif (keystate[SDL_SCANCODE_D])