Raycasting questions

Blitz3D Forums/Blitz3D Programming/Raycasting questions

Yeah, a screenshot would help since I don't fully understand your problem.

I was working on a raycaster that works like this:

The ray ist casting in huge steps, let's say angle*0.2. As soon as the ray enters a new Array field, I mean when array-index is diffrent from the one before, then it is going to make one huge step back and will cast this step in little steps until it reaches the border of the array field. You could then even repeat this with even smaller steps, so you finally have a very correct edge of the block.

But if you want to textue the floor as well then this trick won't work.

Now you want to determine where the ray hit the block? For a texture pixel index you can use a lookup table since you have to multiply the horizontal (0.0 to 1.0) value * Texturewidth.

If you want to know if the ray hits north, south, east or west, there are several Methods to determine this. You can simply compare the index of the previous array field index the ray passed through with the array field index of the block that was hit.