When an overlayed sprite is shown near the edge it is layered under a wall. The layering is determined by the direct distance from the player. I think this might be caused by the weirdness with raycasting, or it may be because of the fish-eye effect?

Any thoughts on what could be causing this/ how to stop it?

Raycastsâ€™ â€śhitâ€ť output gives the distance to the object center instead of the distance to the collision point; perhaps itâ€™s something to do with that?

Hmmm, so this is just off the top of my head, and I have know idea if it would work, but could you maybe compensate for the blockiness by making the pixels/lines (or whatever you are using to make the walls) lower if they are farther to the right or something like that and higher if they are father to the left. Does that make sense?

Another idea that I had was to use trapezoidal integration of some kind. Idk * exactly* how that would be implemented, but I had the idea because the wall looks about like a graph using a left or right riemannâ€™s sum, but if you used trapezoidal integration (since you canâ€™t let n go to infinity, as would be ideal), it would at least make it less

*, you know? In case you have*

**jagged***what it is Iâ€™m going on about, itâ€™s calculus. Basically, if you try to find the area underneath a curve on a graph by using only the values at certain points, you wonâ€™t end up with the exact area, but rather an over or under approximation of the area, because you would be assuming that all values between two points are equal to the value*

**absolutely no idea***either the leftmost or rightmost point, if that makes sense. That appears to be about whatâ€™s going on here. However, if you canâ€™t get the value at EVERY point (infinitely many points) under the curve, then you can still compensate by using trapezoidal approximation, which approximates the area by using trapezoidal to connect the points instead of rectangles. Basically, drawing straight lines between points instead of actually having it curve. Idk if any of this would work, or if I have just COMPLETELY confused you (it confused me when I first learned it), but I hope this helps at least a little bit.*

**at**Hereâ€™s some external explanation of what I talking about, because Iâ€™m almost certain I havenâ€™t explained it in a way that made any sense (if youâ€™re interested, you could probably check out khan academy, too)

https://math24.net/trapezoidal-rule.html

If you want additional explanation or formulas, or help with the math of it, Iâ€™d be happy to help (as much as I can, given that I am bad at explaining things)

Yeah I did actually think of this before, but I have no clue on how to actually make it. right now I have an object for each vertical line, so to make straight lines I would need an object to form a line between each ray cast as well as an object to fill in the area. thinking about it, Iâ€™m not sure it would be able to fill in very well + cause a lot more lag

This is what youâ€™re talking about I think, the only problem would be filling in the missing space between lines (cause rectangles)

I still suggest raycasting to the player and if it hits something else to hide it.