I would like to calculate the distance travelled of an object. I have a start position(mm), an acceleration (mm/s^2), a speed (mm/s) and then a deceleration (mm/s^2). Note the deceleration value can differ from the acceleration. There is also a delay time in seconds
For each frame of time (currently 30 fps) I need to calculate how far the object will have travelled taking into account the initial delay and potentially the object never reaching full speed before slowing again.
I am currently working with:
Time = Seconds Elapsed and not frames
DistanceTravelled = (Speed * (Time - Delay) + (Acceleration * (Time -Delay) ^ 1 / 2)) + ((Deceleration * (Time - Delay) ^ 1 / 2))
but this appears wrong but why?
Deceleration is the result of a force directed opposite the motion. Therefore, the deceleration term should be subtracted, not added. If you do this, the formula will be correct assuming that
Delay, and thenSpeedand is immediately subjected to bothAccelerationandDecelerationIf the above is not what you had in mind (e.g., if you meant a period of acceleration followed by a period of deceleration), please clarify the question.