Between posts at

http://forum.unity3d.com/threads/drag-factor-what-is-it.85504/

and more from stackoverflow which I cannot manage to locate again, I’ve been working on creating a toolset for calculating trajectory to match PhysX’s systems. To that end, I have the calculations completed without drag factored in.

In short, I calculate the velocity to launch from point A to point B in X seconds with

```
HorizontalVelocity = HorizontalDistance * TimeInFlight;
VerticalVelocity = (VerticalDistance + ((0.5f * GravityMagnitude) * (TimeInFlight * TimeInFlight))) / TimeInFlight;
```

and then calculate resultant positions along that curve by multiplying that initial velocity vector (per direction) by a chosen timestep and any applicable gravitational influence.

```
HorizontalPoint = HorizontalVelocity * TimeStep;
VerticalPoint = (VerticalVelocity * TimeStep) - ((0.5f * GravityMagnitude) * (TimeStep * TimeStep));
```

From the aforementioned post, Physx is very definitely defining motion which can be recreated with:

```
void FixedUpdate()
{
velocity = velocity + (Physics.gravity * Time.fixedDeltaTime);
velocity = velocity * (1 - (GetComponent<Rigidbody>().drag * Time.fixedDeltaTime));
transform.position += (velocity * Time.fixedDeltaTime);
}
```

What I have been unable to manage to do, however, is implement that drag into the trajectory calculations. I would presume that drag should be able to be simplified into something like

```
Mathf.Clamp01(Mathf.Pow(1.0f - (drag * Time.fixedDeltaTime), targetTime / Time.fixedDeltaTime))
```

in order to simulate the effects of drag over time, but I have had no success in joining it together with either of the initial velocity calculation or the stepped calculations (to create preview lines, for example) in a way which matches up with the actual physics calculations.

In general, I’ve been aiming for a single formula for these calculations (represented by essentially only using starting point and velocity vector, then getting points at specific times) rather than working incrementally (for example, calculate each physics step one at a time to catch up to the destination point). Am I overlooking something in how I’m attempting to factor in drag ahead of time, or is it even more complicated than I’m realizing?