So I am writing a Sonic engine over here in 2D, and the way angles are calculated in the Mega Drive games is pretty dated (each object has its own angle value). So to counteract that, I tried to automate that by calculating the angle for each edge in polygon colliders. That is fun and dandy, however whenever one of the ground raycasts hit the polygon, I need to tell which edge of that polygon it hit. I’ve tried to compare the raycast point to the coordinates of the point that make the edge, but it spits out weird results. Here’s a representation of what I’m trying to do
I’ve tried to wrap my head around this for hours and I can’t seem to get it. Any help would be appreciated!
