Raycasting (ie Wolfenstein) problem

Started by
0 comments, last by RPGeezus 20 years, 6 months ago
I've been writing a ray caster off and on using some horrible development tools (read no debugger). I cannot change this for the time being. The code works on a grid, just like Wolfenstein, and I cast rays looking for vertical and horizontal intersections. I've run in to a problem where I'm seeing my walls not being drawn like boxes, but instead being draw like this: (overhead view) .----. |.....| |.....| |___|_ ,,,,,,| (please ignore the ') The right and bottom walls seems to be too long! To illustrate the problem, imaging your were looking down a hall way: ie: xxxxxxx -> xxxxxxx What you would see with my engine would be a nice smooth wall to your right, and on the left you would see the smooth wall interupted every wall length by a short perpendicular wall. ie (over head view) xxxxxxxxxxxxxxx ...x......x......x... ..................... xxxxxxxxxxxxxxx Has anybody run in to this problem before? Any help would be appreciated. Will [edited by - RPGeezus on October 20, 2003 4:54:16 PM] [edited by - RPGeezus on October 20, 2003 4:55:05 PM]
------------------http://www.nentari.com
Advertisement
Your distance-calculation is not correct, or the values for it.

Note that (tileX, tileY), where coords are ints, gives the upper-left corner of a tile. Things will work when you calc the distance to the walls to the right of the view in your pic, because you take the distance between the viewpoint and the upper-most edge of the tile. OTOH, for the left walls, u need to take the distance from the viewpoint "to the lower edge", thus add one tile to Y.

This topic is closed to new replies.

Advertisement