I don't understand author's logic when calculating collisions between two circles (bubbles). Here is the Calculating collisions section.
Author writes:
The bubble being fired follows a set of coordinates defined by the equations:
px = ex + tdx py = ey + tdy
where px and py are points on the trajectory of the bubble’s center point. The calculation of px and py happens in jQuery’s animate method and is the standard equation for moving a point along a line. Next, we’ll calculate t at the closest point on this line to the center of the bubble that we’re checking against:
var t = dx * distToBubble.x + dy * distToBubble.y;
I don't understand what t
is and why it calculates by the following formula:
var t = dx * distToBubble.x + dy * distToBubble.y;
?