Skip to main content
improved and captioned picture, added a lot of formatting
Source Link
NPS
  • 2.3k
  • 4
  • 28
  • 51

Here's my idea (sorry for terrible picture, I've used Paint :P):

enter image description here

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.

Here's my idea (sorry for terrible picture, I've used Paint :P):

enter image description here

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.

Here's my idea (sorry for terrible picture, I've used Paint :P):

enter image description here

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.

improved and captioned picture, added a lot of formatting
Source Link
NPS
  • 2.3k
  • 4
  • 28
  • 51

Here's my idea (sorry for terrible picture, II've used PaintPaint :P):

enter image description hereenter image description here

In the first picture you see a moving circle #1#1 (red arrow is its moving direction) and a static circle #2#2. Red line is drawn along the moving direction vectormoving direction vector. Let's say the moving circle's radius is R1R1 and the static one's is R2R2. In 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#2 (C2) and its radius equals R1 + R2R1+R2.

Now you calculate the crossing pointscrossing points of the red line and the 3rd circle #3 (equate line's and circle's equations). The will give you 22 points (or 11 in verya special case, or 00 if the circles actually don't collide). You should discard the point that is farther away from circle #1's#1's original center position (from the previous frame) - 'C1'.

Now you just calculate the point between circle #2's#2's center C2 and the line-circle crossing pointcrossing point (C1') calculated in the previous step - which is exactly R1R2 away from circle #2's#2's center C2. I might have describedYou can do that complicatedly but I hope you get the ideaeasily by using lerp (linear interpolation): collision_point = lerp(C2, C1', R2/(R1+R2)). Anyway, thatThat is the 2 circles' collision pointcollision 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.

Here's my idea (sorry for terrible picture, I used Paint :P):

enter image description here

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. In the second picture you can see the moment of collision. You can imagine a third circle - one that has its center in the same point as circle #2 and its radius equals R1 + R2.

Now you calculate the crossing points of the red line and the 3rd circle (equate line's and circle's equations). The will give you 2 points (or 1 in very 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).

Now you just calculate the point between circle #2's center and the line-circle crossing point calculated in the previous step - which is exactly R1 away from circle #2's center. I might have described that complicatedly but I hope you get the idea. Anyway, 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.

Here's my idea (sorry for terrible picture, I've used Paint :P):

enter image description here

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.

Source Link
NPS
  • 2.3k
  • 4
  • 28
  • 51

Here's my idea (sorry for terrible picture, I used Paint :P):

enter image description here

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. In the second picture you can see the moment of collision. You can imagine a third circle - one that has its center in the same point as circle #2 and its radius equals R1 + R2.

Now you calculate the crossing points of the red line and the 3rd circle (equate line's and circle's equations). The will give you 2 points (or 1 in very 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).

Now you just calculate the point between circle #2's center and the line-circle crossing point calculated in the previous step - which is exactly R1 away from circle #2's center. I might have described that complicatedly but I hope you get the idea. Anyway, 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.