r/howdidtheycodeit • • Jan 30 '24

Question How are the web collisions coded?

684 Upvotes

45 comments sorted by

View all comments

Show parent comment

9

u/fleeting_being Jan 31 '24

Or just do many more raycast per frame. It doesn't have to be perfect, just more accurate than a pixel

12

u/SlothWithHumanHands Jan 31 '24

no need to do more of a less accurate thing — you can sweep a line into a quadrilateral and calculate a parameter t that finds the exact intersection with a polygon. for thread unwinding, a negative dot product of current thread and most recent incident thread perpendicular would indicate when to collapse into a free thread.

9

u/HypnoToad0 Feb 02 '24

I like your words, magic man.