Sprite raycaster without fisheye

Well, so, using the negative of the angle won't hurt, and it'll make the code clearer because the reader will see that there's really only one angle involved.

So here:

Here it is in action:




(it is right so far, as long as those numbers are right; the signs and order are right)

Edit: they're right.

Oh, that's got nothing to do with dot product or cross product; it's multiplication by a 2x2 matrix.

About angles and signs: Make sure you get the answers you want for rotation by 110, 200, and 290 degrees.

These appear to be correct:



Umm maybe I'm confused, but not if you want Snap!-style (a/k/a Scratch-style) angles, in which clockwise is positive, so when you rotate the unit vector by 110 degrees, it's pointing a little past straight down, so x should be a small-magnitude negative number and y should be an almost-1-magnitude negative number.

But 110 is 20 greater than 90, which is straight right. You are confused.

Edit: I'm rotating the LOGO/Scratch/Snap! 0° unit vector (0x,1y) 110° clockwise.

The rotation angle isn't an absolute such as you'd get from the DIRECTION reporter. It's a relative angle as in TURN ↻ 110 DEGREES. If you take the east-pointing unit vector and turn it right 110 degrees, it should be pointing a little bit west of south.

Since we have both cw and ccw turn commands, you might think that you can choose either as your standard. But TURN ↻ 110 DEGREES adds 110 to DIRECTION, whereas TURN ↺ subtracts 110 from DIRECTION.

I understand, but I don't get how absolute vs. relative angles have to do with what I'm doing.

I made a door test using this Raycaster.

I will probably add animations to the door and see if it will render those animations.

That's thinking of 110 as an absolute angle.

Yes, but in this case I'm adding 110 to 0, not 90 as you seem to think.

?? The unit vector in your pictures is pointing to the right, so that's DIRECTION = 90.

The vectors are (0,1), i.e., this:


(taking 100 on the grid as my 1 unit)

Oh! I swear I saw pictures in this thread with arrows pointing to the right before rotation, but I can't find them now, so maybe I dreamed it. Sorry... Today's not my day.

Maybe.