[Physics] Modeling the motion of a bouncing ball

gravityprojectiletime

I'm writing a program that displays a line of text, and animates a ball that bounces from syllable to syllable (like a sing-along). The program knows the location of each syllable, and it knows at what time the ball should be at each syllable.

I have a set of equations that work OK, but not great. I came up with them a few years ago after much googling and stumbling about. They take the location of the previous syllable ($x_0$, $y_0$), the location of the next syllable ($x_1$, $y_1$), the time t (from start 0 to finish 1), and compute where the ball should be ($x$, $y$):

$$d = x_1 – x_0$$
$$v = d/t$$
$$ h = 5 + 0.3 |d|$$
\begin{align}
x(t) &= x_0 + v t\\
y(t) &= y_0 – h + \left[4 \frac{h}{d^2} \left(\frac{|d|}{2}- |v| t \right)^2 \right]
\end{align}

What I would like is a better set of equations that more accurately model the motion of a bouncing ball. A ball with a mind of it's own, I suppose, as it does need to change speed and direction with each new syllable.

Best Answer

You need the position of the ball $(x(t)$, $y(t))$ for $0<t<1$ if at $t=0$, the ball was thrown with initial velocity $(v_x,v_y)$ at the position $(x_0,y_0)$ in a gravitational field of acceleration $\overrightarrow{a}=(a_x,a_y)=(0,-g)$. The velocity has to be calibrated in order to make the ball arrive the point ($x_1,y_1$) at $t=1$.

The position of the ball is given by

$$x(t)=x_0 + v_x t$$ $$y(t)=y_0 + v_y t - g\frac{t^2}{2}$$

We want to obtain $(v_x,v_y)$ to get $x(t=1)=x_1$ and $y(t=1) = y_1$, so,

$$x(t=1)=x_0 + v_x = x_1$$ $$y(t=1)=y_0 + v_y - \frac{g}{2} = y_1$$

and therefore,

$$ v_x = x_1 - x_0$$ $$ v_y = y_1 - y_0 + \frac{g}{2}$$

and finally, your movement equations are:

$$x(t)=x_0 + (x_1 - x_0) t$$ $$y(t)=y_0 + (y_1 - y_0 + \frac{g}{2}) t - g\frac{t^2}{2}$$