Since we can decompose the vecloity into its components

Now position is the integral of velcoity and

setting the above function (the height of the goal post) will give you the time you need. The velocity is constant in the x direction (no acceleration) so the distance is