theTechnoKid - 3 months ago 40

Java Question

I am using this drag formula in a simulation game:

`double drag = (p * Math.pow(u, 2) * C * A) / 2;`

(See Drag on Wikipedia)

This equation works for a short while, till the drag force is greater than the velocity, and the object (a rocket) starts falling instead of rising slower. Currently I am subtracting the drag force from the

`y`

`x`

Is their a simpler formula or a way I can get this to work by including frames per second, which is set at 60?

Answer

A force cannot be greater than a velocity (the units are incompatible). If the drag force is greater than the thrust then your rocket will decelerate. Drag cannot make anything fall (drag would then start working to slow the fall).

Force = mass * acceleration, so acceleration = force / mass. Acceleration is the change in velocity. There are three separate forces acting on your rocket: The thrust of the rocket, gravity and drag. You need to calculate the final force (a vector product) that is operating on your rocket [by "adding" them together] to determine the acceleration and then how that will make it's velocity will change each frame.