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?