Ok - I think this'll make my approach clearer, but my communication could do with some improvement still.
PDF Version In text here:
Initial setup: we need to know the time it takes to reach a point at the same time as the ball. From time direction, position are calculatable fairly easily.
In order to solve with simple math, I propose using a 1D direct line between Ball and (each) Guy. This way we can solve with a straightforward timing calculation, and move back to full 2D with simple trig afterwards.
Math:
(Its been years since I did anything for anyone to look at, and my use of math in programming tends to be pseudocode -> compiler -> look at what errors spring up. The following may contain errors in type (int degrees/radians particularly) and code.
G1(2D) is:
G1Pos = BallPos + unityvector(direction to GuyPos) x (ballSpd*T1)
G1(1D math – dist from Ball to G1) is:
G1 = ballSpd*T1 = ballSpd*T1/(guySpd*T1+ballSpd*T1) * vec_dist(GuyPos,BallPos)
Therefore: T1 = T1/(guySpd*T1+ballSpd*T1)*vec_dist(guyPos,ballPos)
T1 = vec_dist(guyPos, ballPos)/(guySpd+ballSpd)
Timefactor = T1*cos(angle delta) //angle delta is angle between (ball-guy & ball–Goal)
I think that will clear it up, and I’ll leave it to you to test with real code. Anything further I write will screw with type errors etc.
Don
Have a great day