I've made a simple raycaster with 3 rays, each feeding into a separate list then then after they've finished scanning broadcasts to the renderer and it draws, my problem is that at the end of each array (the 3 sprites cover 50 degrees, 20,10,20) the line is shorter than it should be ie. the 20th, 30th and 50th rays are about 50 steps shorter than they should be.
Offline
I'm afraid it's going to be pretty hard to help without being able to see the code.
Offline
Like what AtomicBawm3 said, I don't understand how to help without seeing the code. But, I can show you this guide that you can use to find your mistake. If your talking about the fisheye problem, where even if you're looking at a straight wall the wall looks curved, you would have to use cosine or something like that. AtomicBawm3 could help you with that if that's the problem.
Offline
zammer990 wrote:
My code is basically the exact same thing, all that's different is that I use start my counting variable at 1 and go up. And cosine? I've found no need for trigonometry in this?
basically, if you have 3-rays moving 1 step then adding one to a "wall distance" variable, instead of having add wall distance to list you would have
add <<[cos v] of (wall distance)>*(angle offset)> to [wall distances v]
Last edited by TorbyFork234 (2012-05-15 19:15:08)
Offline
TorbyFork234 wrote:
zammer990 wrote:
My code is basically the exact same thing, all that's different is that I use start my counting variable at 1 and go up. And cosine? I've found no need for trigonometry in this?
basically, if you have 3-rays moving 1 step then adding one to a "wall distance" variable, instead of having add wall distance to list you would have
add <<[cos v] of (angle offset)>*(wall distance)> to [wall distances v]
Fixed.
The reason for the use of the cosine is that if it's not used there's a fisheye effect basically creating a bulge in your drawing.
Offline