I'm implementing a simple Volleyball game using Box2D in Flash. I need to implement some AI for the CPU player. Let's call him Jack. So Jack needs to predict where's the ball gonna land after it has been hit by John, the human player. I have the following information :
Initial Linear Velocity (both in x & y-direction) of the ball when John hits it.
The initial position of the ball when John hits it. (x & y coordinate values)
The value of gravity.
The value of y position of the floor where's the ball's gonna fall.
The angle at which John hits the ball.
The ball follows a projectile trajectory.
So Jack needs to predict what would be the position (x value) of the ball when it hits the floor.
I think as the ball follows a projectile trajectory the problem might be seen the same as that of - firing a cannonball from some known initial position, known initial velocity with fixed gravity and predicting its landing spot. The ‘y’ value of the landing spots is also known. The air resistance is zero.
Is there any kind of mathematical equation that might help to predict the x value of the landing spot? I took a look at some projectile equations but most of them take 'time' as a variable. I need to have a solution that doesn't involve this 'time' variable. Any kind of workarounds for this problem would also be appreciated. Thank you! :)