Skip to content

Improved version of "Timesteps and Achieving Smooth Motion in Unity"

Notifications You must be signed in to change notification settings

develax/Smooth-Motion-in-Unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Smooth Motion in Unity (refactored)

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:

  1. InterpolationFactorController a singleton scene component (the original name was InterpolationController) that calculates the current interpolation factor.
  2. InterpolationObjectController a component for a moving object (the original name was InterpolatedTransform) which calculates the current interpolation for the object in the Update() method before it's being rendered and then restores its original transform values for the next FixedUpdate() call.
  3. The InterpolatedTransformUpdater component was removed as unnecessary.

Remarks

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.

About

Improved version of "Timesteps and Achieving Smooth Motion in Unity"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages