SHARE
TWEET

Untitled

a guest May 23rd, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static IEnumerator MoveTo(Vector3 from, Vector3 to, float duration, Action<Vector3> onChange)
  2.     {
  3.         float t = 0;
  4.         Vector3 currentPosition = from;
  5.        
  6.         while (t < duration)
  7.         {
  8.             currentPosition = Vector3.Lerp(from, to, (t / duration));
  9.             onChange(currentPosition);
  10.             t += Time.deltaTime;
  11.             yield return null;
  12.         }
  13.         onChange(to);
  14.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top