Here's my idea (sorry for terrible picture, I've used Paint
:P):
In the first picture you see a moving circle #1
(red arrow is its moving direction) and a static circle #2
. Red line is drawn along the moving direction vector
. Let's say the moving circle's radius is R1
and the static one's is R2
. Circle #1
's center point is C1
and the other one's is C2
. Circle #1
's center point after moving is C1'
.
In the second picture you can see the moment of collision. You can imagine a third circle #3
- one that has its center in the same point as circle #2
(C2
) and its radius equals R1+R2
.
Now you calculate the crossing points
of the red line and the circle #3
(equate line's and circle's equations). The will give you 2
points (or 1
in a special case, or 0
if the circles actually don't collide). You should discard the point that is farther away from circle #1
's original center position (from the previous frame) - 'C1'.
Now you just calculate the point between circle #2
's center C2
and the line-circle crossing point
(C1'
) calculated in the previous step - which is exactly R2
away from circle #2
's center C2
. You can do that easily by using lerp
(linear interpolation): collision_point = lerp(C2, C1', R2/(R1+R2))
. That is the 2 circles' collision point
you wanted.
One more note - when you calculate all that on paper try to simplify/reduce the formulas - I didn't do that myself now but there's a good chance you end up with a nice concise formula.
And now that I think about it, it's actually a very important step - if I'm not mistaken, if you can bring all the transformations down to one formula and simplify it maximally, you should get the optimal formula for calculating the collision point regardless of the method used to derive it.