I have a soccer game where I kick the ball using Unity’s AddForce function. I am adding an Impulse force. The kick direction is based off a raycast click. Knowing the force I put on the ball (kick direction * shot power), the distance from the ball to the target position, and the ball’s mass… How can I find the time it will take for the ball to reach the target position? I want to use the time variable to use in a coroutine in order to trigger the goalkeeper’s dive at the right time.
That depends on the air drag that acts on the ball.
It also depends on the direction of the shot (high arc, low arc.)
It also requires you to assume it doesn’t bounce on ground before reaching the goal.
Easiest way out would be to build a lookup table, using data from test-shots.
Note that you have to rebuild the table if you change any of your physics parameters: ball mass, ball drag, gravity, etc.