zak wrote:velocity = a * step
position = 0.5 * a * step * step
This is the particular solution of the equation of motion for a particule under constant acceleration.
position = 0.5 * a * step * step
the 0.5 comes from knowing that acceleration a, is constant and solving the equation analytically assuming initial velocity is zero.
when the acceleration is not constant, the solution is wrong for all other cases, and using that particular solution of a diffrencail equation as if it was a general solution of the same equation in a numercial integration proccess, is a very bad idea.
Instead we use the the general differencial equation of motion and we use an appropiate numercial integration to calculate a good aproximation to the solution, because the acceleration is a secund order differencial equation
first integrate acceleration to obtain first derivative, then integrate velocity to obtain the secund derivative.
zak wrote:velocity = a * step
position = velocity * step = a * step * step
this is the correct solution for all cases because generates an aproximation that minizes the error when the integeration is numerical.
for example if instead of a constant acceleration the force was a spring, the first solution will always generate an explosion, while the secund solution is stable if the integation step is smaller compared to the period of the spring natural frequecy.
believe me the first method is the one method you do not want to use if you do not have the analytically expression that you can integrate numerically.