lefticus / raycasting

Apache License 2.0
15 stars 4 forks source link

Get rid of the weird magic numbers. #4

Closed pjfordham closed 1 year ago

pjfordham commented 1 year ago

Clean up the FOV calculations. Removed the magic numbers and hopefully made it clearer from the variable names how the logic of this actually works.

If you always lock you vertical FOV to 90 degrees you can fold out some of the math. ( tan 45 == 1, etc. )

Also made a hole in the wall to more easily see the square squares.

In terms of vertical FOV the draw height of the wall should match the full window height when you are 1 unit of distance away from said wall.