How do I calculate the parabola of a molotov with only angle and distance?

74 Views Asked by At

I am playing a game where you can shoot a molotov. My goal is to be able to choose a distance I want the molotov to land (from the player) and get an angle to aim to reach that, the game has no information about gravity, resistance, velocity etc so calculating it with physics is not possible, however all of the previously mentioned variables are constant.

Currently, I am aiming up to the sky as much as is allowed then slowly moving my mouse to look down/forward, I then record my mouse movement to get the angle. My screen height is 1080 pixels do I can get angle with a = (pixels_down/1080)*90.

My first approach was just finding a fixed value and doing a calculation, my first one was angle_to_aim = desired_distance*5.2, which worked ok, but failed past or before a certain range.

I also tried linear regression, but it didn't work because it's a parabola.

My question is, if I gather a bunch of data, how can I calculate the parabola or predict where the molotov will land? Here is a little bit of data I have gathered thus far:

graph 0-78 pixels always results in 0 meters (straight back down)

1

There are 1 best solutions below

9
On BEST ANSWER

Looks like your "number of pixel" $p$ is proportional to $\cos\theta$, where $\theta$ is the angle between initial velocity and ground. Moreover, I'll assume your projectile is launched from negligible height.

If so, the formula for the range of a projectile can be written as: $$ d=kp\sqrt{m-p^2}, $$ where $k$ and $m$ are two constants to be determined.

One can use two of your lines of data to find them: taking the first and penultimate line (the last one looks a bit off) I got: $$ k\approx 0.000361126,\quad m\approx 278922 $$ which gives results in fair agreement with the other data.