In this article I derive a ray-sphere intersection algorithm from it's math. While certain knowledge in mathematics and programming will be assumed, I am trying to show all the steps of the process.
Ray-sphere intersection is used to determine wether and where a ray hits a sphere. This is useful in selecting 3D objects with the cursor (well, spheres in this case), calculating bullet hits in games, etc., but you knew that. Why else would you look up such a specific topic?
So let's start with what we have: a sphere (your object, a hitbox, ...) and a ray (a bullet, your cursor, ...). What we we'd like to know is, if they intersect and what the intersection point(s) are, if any.
For years I have used the "Open Calculator"-button on my keyboard as a hotkey to open KeePass. When I set up my new laptop, I wanted to configure KeePass to use my hotkey again – but it didn't work anymore.