0
$\begingroup$

I’m trying to calculate the angle(s) a projectile has to be launched at in a game that has a simulated drag which reduces the velocity by 2.5% of the current velocity per tick (25 milliseconds). This is independent from it’s shape and mass.

I'm given initial speed, distance and gravity. I know that theta is:

Formula for launch angles

Where $v$ is the initial velocity, $x$ the distance and $y$ the initial height.

And I figured that the function of velocity for an object after it’s launched is exponentially decaying so I came up with this function:

Function for Velocity

Where v_0 is the initial speed, 2.5 is the percentage and 0.025 the tick rate.

Is there a way to account for this drag in the original formula or is there a different one? So far I only found formulas for linear drag but I'm not sure how I would incorporate this as this drag isn’t dependent on an objects mass and terminal velocity.

$\endgroup$
1
  • $\begingroup$ Where is the drag coefficient in your equation? $\endgroup$
    – Eli
    Dec 5, 2022 at 15:47

1 Answer 1

0
$\begingroup$

What you're doing is modeling an object with "linear drag". Since the rate at which the velocity decreases is proportional to the velocity itself, we can write $$ \frac{\Delta v_x}{\Delta t} = - \frac{0.025 v_x}{25 \text{ ms}} = - \alpha v_x $$ (more or less), with $\alpha = 10 \text{ s}^{-1}$. A similar equation holds for $v_y$, but with the gravitational acceleration of $-g$ factored in.

Since the drag is linear, it is possible to solve exactly for the position and the velocity as a function of time; I did so in my answer here. However, finding a "range equation" is a much harder; you would have to find the time $t$ of the landing of the object and then figure out the value of $x$ at that time, which I don't think is actually doable algebraically (since $y(t)$ is transcendental in $t$.) Trying to find a nice function for $\theta$ as a function of the desired range is probably a fool's errand.

The best tactic would be to solve the problem iteratively, just like the artillery officers do in the real world: generate a trajectory, see where it lands, adjust the angle accordingly, and repeat until the answer is "close enough".

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.