Timeline for X axis intersection with inverted Y axis coordinates
Current License: CC BY-SA 4.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 18, 2022 at 13:34 | comment | added | HolyBlackCat | @AlexCB I think it would be different. Look up something like "2d ray box intersection". | |
| May 18, 2022 at 13:29 | comment | added | Alex CB | Just for my knowledge: if the aerolites don't pass by the center of the screen, tweaking this code can work, or that's a completely different story? | |
| May 18, 2022 at 13:25 | comment | added | Alex CB | You genius! It works! At least on paper ;) | |
| May 18, 2022 at 13:21 | vote | accept | Alex CB | ||
| May 18, 2022 at 12:29 | comment | added | HolyBlackCat | (assuming Y is inverted for both the world and the gui) | |
| May 18, 2022 at 12:07 | comment | added | HolyBlackCat | @AlexCB Inverted-ness of Y doesn't affect the math. If 0,0 is in the corner, you need to subtract half window size from the coords before doing anything else, then add it back when you're done. | |
| May 18, 2022 at 12:00 | comment | added | Alex CB | I like this a lot! I've tried on paper and works flawless. However, and I'm sorry if it's too trivial, but I tried this in a inverted Y-axis with the 0,0 coord being the top left and gives wrong results, of course. I suppose I've to add width/2 and height/2 of the screen somewhere and do something with the Y coord. Can you tweak your code to reflex this? | |
| May 18, 2022 at 5:25 | history | edited | HolyBlackCat | CC BY-SA 4.0 |
added 10 characters in body
|
| May 18, 2022 at 4:25 | comment | added | Mangata |
This is a neat and clever answer, I guess using similar triangles or something? But it should be pointed out that just using max is not enough, you need to compare their absolute values, I guess?
|
|
| May 17, 2022 at 18:43 | history | answered | HolyBlackCat | CC BY-SA 4.0 |