1

I'm creating an asteroids game. For player movement, I want the spaceship to be slowed down as if by a drag force, see e.g. https://en.wikipedia.org/wiki/Drag_(physics), and only the drag force. The magnitude of the drag force is proportional to $v^2$, and I decree that all other parameters are constant in the fantasy world I'm building.

Since force is proportional to mass by acceleration and the mass of the spaceship is constant, the acceleration is proportional to $-v^2$; negative as the force is in the opposite direction of the velocity.

The acceleration is the derivative of velocity, so $\frac{dv}{dt} = -c_m v^2$. This is a separable differential equation, solvable as $-c_m \int (v^{-2})dv = \int 1\, dt$, implying $c_m v^{-1} = t + c_i$ or equivalently $v = \frac{c_m}{t + c_i}$. I choose $c_m$ and I know $v$ at time $t = 0$, so I can calculate $c_i$.

I am told that given the form of $v$ as a function of $t$, the location of the spaceship as a function of time will be on the form $c_m \ln (t + c_i)$—in general, $\int \frac{f'(t)}{f(t)} dt = \ln|f(t)| + c$, but I'm limiting myself to $t > 0$ (and I can pick $c_m$ such that $c_i \geq 0$), so I can omit the absolute value.

Did I botch any of the physics or math? Is the location as a function of time calculated correctly?

Gert
  • 35,561

0 Answers0