This uses the same algorithm as my raycaster with stairs project does now if you want to add it to your own raycaster with different height or something of that sort please comment and ill teach you how to do so.
if it doesn't work the way you intended please give me the values you inputted and ill try to fix it UPDATE: made unnecesary values being added removed: like 50 -20 -20 -40 NOTE: the -1 type is far from being done as there are lots of bugs that could happen if used :( that's why i dont recomend using it for more 3d'ish projects but if you only plan to use the -1 with only one object getting passed through then it should work fine :)