Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm assuming that you want the ball to hit that specific point (200,200) at the apex of its path. Well, my physics is a bit rusty, but this is what I've thrown together:</p> <p><code>v_y = square_root(2*g*y)</code>,</p> <p>where g is a positive number reflecting the acceleration due to gravity, and y being how high you want to go (200 in this case).</p> <p><code>v_x = (x*g) / v_y</code>,</p> <p>where x is how far in the x direction you want to go (200 in this case), g is as before, and Vy is the answer we got in the previous equation.</p> <p>These equations remove the need for an angle. However, if you'd rather have the velocity + angle, that's simple:</p> <p><code>v0 = square_root(v_x^2 + v_y^2)</code></p> <p>and</p> <p><code>angle = arctan(v_y / v_x)</code>.</p> <p>Here is the derivation, if you're interested:</p> <p><code>(1/2)at^2 + v_yt + 0 = y</code></p> <p><code>(1/2)at^2 + v_yt - y = 0</code></p> <p>by quadratic formula,</p> <p><code>t = (-v_y +/- square_root(v_y^2 - 2ay)) / a</code></p> <p>we also have another equation, because at the apex the vertical velocity is 0:</p> <p><code>0 = v_y + at</code></p> <p>substitute:</p> <p><code>0 = v_y + (-v_y +/- square_root(v_y^2 - 2ay))</code></p> <p><code>0 = square_root(v_y^2 - 2ay)</code></p> <p><code>0 = v_y^2 - 2ay</code></p> <p><code>v_y = square_root(-2ay)</code>, or</p> <p><code>v_y = square_root(2gy)</code></p> <p>For v_x:</p> <p><code>v_x*t = x</code></p> <p>from before, t = v_y / a, so</p> <p><code>v_x = (x*g)/v_y</code></p> <p>I hope that made enough sense.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload