I am a game dev that recently became interested in implementing a character jump with a given height (H) and duration (T). I came across this article. In it, the author offers two solutions, but the one I am interested in is the first. Given the equation:
$$y (t) = p_0 + v_0 t + 1/2 g t^2$$
Where, $p_0$ is the initial position of an object, $v_0$ is its initial velocity, $g$ is a gravitational constant, and $t$ is the duration of the object's movement. According to the article, to get a parabolic "jump effect" based on a given height and duration:
We compute the equation for $t = T/2$ and for $t = T$, imposing that $y$ is $H$ in the first case and 0 in the second case. We also impose that $y0$ is 0 since we’re starting the jump from ground level (we may actually be starting from any height, but all we want from our jump is that it requires time T to be back to the starting height, so we can just set our reference frame so that the starting height is 0).
In that case,
$$p_0 = 0$$ $$H := y (T/2) = v_o (T/2) + 1/2 g (T/2)^2$$ $$0 := y (T) = v_0 (T) + 1/2 g (T)^2$$
Which I understand can be used to solve for $g$ and $v_0$, and in doing so, it gives:
$$g = -8 H / T^2$$ $$v_0 = -g T / 2$$
I'll admit that I am still working on upping my math skills, so I was wondering if anyone could walk me through how one could get to the answer that this author did when solving for $g$ and $v_0$?
(From what I could gather, to solve for $v_0$, you would subtract $1/2gt^2$ on both sides, then divide by $t$ when H = 0. However I am kind of confused by finding $g$. When $v_0 = 0$ in the first equation, you would just need to divide $t^2 / 8$ on both sides, but how and why does $V_0$ become zero?)