Disclaimer. I'm an idiot, and I have no clue of anything. My math is horrible, I cannot prove anything, I barely know what "vectors" are, my approach is probably idiotic, and I'm probably not even handsome.
So here's my approach, that you may laugh at until someone else posts a better one
I'm going to pretend that neither player nor ball are anything but a small point in space.
Suppose the speed of the player is v_p (vector), and his starting position s_p. The area he may be in after the time "t" has passed is the circle/sphere (depending on 2d/3d) with the center point "s_p" and the radius "|v_p|*t" (with |v| being the length of vector v). RIGHT?!
The position of the ball at any time may be expressed as s_b+v_b*t.
For simplicity, let's ignore the third dimension and simply pretend it would only exist in 2D (that could be a problem when you shoot the ball high into the air, but who does that anyway?! ;))
As the "player-area" is a circle, we can simply calculate when the distance from ball to player is <= |v_p|*t.
Problems: There are likely going to be several "t" for which this is true. We need the smallest t.
The difference vector between startingpos of player and ball is:
s_b+v_b*t-s_p
so in our two dimensions
s_b.x+v_b.x*t-s_p.x | s_b.y+v_b.y*t-s_p.y
for the length of said vector, we get:
sqrt( (s_b.x+v_b.x*t-s_p.x)² + (s_b.y+v_b.y*t-s_p.y)² )
and our condition would be
sqrt( (s_b.x+v_b.x*t-s_p.x)² + (s_b.y+v_b.y*t-s_p.y)² ) <= |v_p|*t.
Of course, there may be several (or zero!) "t" for which this is true.
We may assume that the smallest "t" is the t for which said condition is "barely" true, i.e. for which the length of our vector is "exactly" |v_p|*t. Let's call this "t" "t0", then we get
sqrt( (s_b.x+v_b.x*t0-s_p.x)² + (s_b.y+v_b.y*t0-s_p.y)² ) = |v_p|*t0.
I'll probably make mistakes in the following.
(s_b.x+v_b.x*t0-s_p.x)² + (s_b.y+v_b.y*t0-s_p.y)² = (|v_p|*t0)²
then we get
t = (sqrt( - s_b.x² * (v_b.y²-|v_p|²) + 2*s_b.x*(s_b.y*v_b.x*v_b.y + s_p.x*(v_b.y² - v_p²) - s_p.y * v_b.x*v_b.y) - s_b.y²*(v_b.x²-|v_p|²) - 2*s_b.y*(s_p.x*v_b.x*v_b.y-s_p.y*(v_b.x²-|v_p|²)) - s_p.x²*(v_b.y²-|v_p|²) + 2*s_p.x*s_p.y*v_b.x*v_b.y - s_p.y²*(v_b.x²-|v_p|²) ) - s_b.x*v_b.x - s_b.y*v_b.y + s_p.x * v_b.x + s_p.y*v_b.y )/(v_b.x²+v_b.y²-|v_p|²)
(We also get another solution for t, but that one would be negative and thus, wouldn't make sense).
Thats it. Because this is very complicated, here is the formula as a graphic:
LINK. Be warned: The graphic is almost 2400 pixels wide.
Is that correct? NO IDEA. Sorry. I actually just asked my almighty calculator to solve that for me. So there is a good chance for me accidently entering wrong things or having typos when I got this. So you may want to check the math here.
Well, you probably don't really
want that, but you know...
-----
Because that is such a complicated formula, it might be worth to think of easier, not as accurate approaches, for instance, by using the dot-product between difference vector of startingpositions with the velocity-vector of the ball, and dividing that by the length of the velocity-vector of the player..... Well... okya, that wouldn't work, but something along these lines might be wiser.
Now: Let us wait until someone gives us a better approach and/or shows us how wrong my approach is.