This is an improved (refactored) version of the code from the "Timesteps and Achieving Smooth Motion in Unity" article.
Now, there are only 2 components instead of original 3:
InterpolationFactorController
a singleton scene component (the original name wasInterpolationController
) that calculates the current interpolation factor.InterpolationObjectController
a component for a moving object (the original name wasInterpolatedTransform
) which calculates the current interpolation for the object in theUpdate()
method before it's being rendered and then restores its originaltransform
values for the nextFixedUpdate()
call.- The
InterpolatedTransformUpdater
component was removed as unnecessary.
For these scripts to work correctly the user's script must change the object's transform
only in the FixedUpdate()
method. When teleporting the object the user should call the (InterpolationObjectController
).ResetTransforms()
method after it.