Click and drag the two ends to move the points. Play around with it for a bit! :) I now made it so that the dot collides with the line, just like what you would see in a pen platformer. I'm not sure how the speed and physics would compare to a slope-based algorithm, so I may try it out some time. The benefit of this "algorithm" is that it's fast and simple. There may be a lot of multiplying, adding, and subtracting, but the only costly function is one sqrt. That's it! Here's a desmos link explaining how this works (outdated): https://www.desmos.com/calculator/skxqsbo1y9