Home > Back-end >  How do I fix wall warping in my raycaster?
How do I fix wall warping in my raycaster?

Time:10-14

So I have made a raycaster in python using pygame. I cast my rays little bit by bit and once they've hit a wall, I calculate the distance and use that base the height of my walls. The problem is that my walls are curved.

Sadly my photos cannot upload but I will try my best to explain.

I had thought I had fixed this problem by adding this

            angle = math.radians(self.view - degree)
            dist *= math.cos(angle)

But with that the walls to the left or right of me would still be curved. I've tried for several hours to try to fix this by I cannot seem to find the correct answer. If you have an idea please comment!

Here is the full code or you can play it

  • Related