Given I know two sphere's centre coordinates and their radius.
Let's say both spheres travels in some direction in a straight line.
At t=0, sphere 1 is at (0, 0, 0) and sphere 2 is at (50, 0, 0), their radius is both 30.
At t=1, sphere 1 is at (100, 0, 0) but sphere 2 is at (-50, 0, 0).
How do I check if sphere 2 have passed through sphere 1? (Just touching also count as "passed through").
By just touching, I mean the path the two spheres took touched but didn't overlap.
I can imagine the volume of the two spheres gouging out a capsule, and if this capsule encompasses any portion of the other capsule, then sphere 2 have gone through sphere 1 (true), other wise false.
But I don't know how to verify if a portion of a volume is in another volume.
Scrappy visual of what I'm saying:
One sphere travels from yellow to grey, another travel from maroon to purple, how do I tell if the two paths overlap at some point.
Update:
Emac have provided an amazing break down of the problem, but I have failed to extend it to more complex scenarios.
Take this scenario:
All spheres have a radius of 0.5.
The centre coordinates of Red and Blue spheres at time t=0 are at (5, 2, 4) and (1, 3, 6) respectively.
At t=1, the red sphere remained stationary, and the blue sphere have travelled to (6, 2, 3.5).
Examine this images, where I have lined up the camera with the end and start position of the blue sphere (final position of blue sphere is now green):
We can see clearly that the path of the blue sphere will intersect the red sphere at some point in time.
I attempted Emac's answer on this scenario. In my mind, the formula should still work. The derivative of the squared distance between two points in 3D space, then solving for the minimum of that formula seems like a universal solution to all these scenarios, but when I applied the formula, I got t = (4, 0, -2), and I can't make sense of a time vector. I thought perhaps I needed to find the magnitude of this time vector, and that will be my answer, but it returned a time larger than 1, which also doesn't make sense.
To go even further, what if both spheres are both in motion, and they each move diagonally through space, eventually grazing each other at some point. Their radius must be accounted, intersection does not mean full overlap.