Skip to content

Instantly share code, notes, and snippets.

@peroon
Created November 26, 2015 12:10
Show Gist options
  • Save peroon/0735e794680e56a72b90 to your computer and use it in GitHub Desktop.
Save peroon/0735e794680e56a72b90 to your computer and use it in GitHub Desktop.
Interpolate.cs
// Interpolate the position and the rotation.
var p = (t - intervalCounter) / delta;
var position = Vector3.Lerp(previousPosition, transform.position, p);
var rotation = Quaternion.Slerp(previousRotation, transform.rotation, p);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment