I'm trying to make a simple explicit dynamic solver for projectile motion in 3D, including drag and gravity, and suspect I'm doing something basically wrong.
Drag force is given by $D = 0.5 \rho V^2 C_d A$
I thought about it, and decided that I could just calculate the components of the drag in ny global axes, i.e. $D_x, D_y, D_z$ by using the components velocity components i.e. $V_x, V_y, V_z$.
However when I try this with an initial velocity of say $(5, 1, 5)$, I can see that in the $x$-$y$ plane I have a curve, not a straight line. That's clearly wrong, cause without a "side wind" I wouldn't expect the projectile to move away from it's initial path in that plane. Yet I guess it is the correct result of taking components! So I think I have to calculate the length of the vector $(V_x, V_y, V_z)$, calculate $D$ as a scalar, then generate a vector of length $D$ in the same direction as $(V_x, V_y, V_z)$ etc, which will be much slower.
Where am I going wrong in thinking I can just calculate $D_x, D_y, D_z$ using $V_x, V_y, V_z$?