SHARE
TWEET

Untitled

a guest Feb 19th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void pRotateAndPosition()
  2. {
  3.     _TimeElapsed += (Time.deltaTime / TimeInSecondsInWhichWeWantToGetToFinalRotationAndPosition);
  4.  
  5.     if (_TimeElapsed >= TimeInSecondsInWhichWeWantToGetToFinalRotationAndPosition)
  6.     {
  7.         _StopCallingThisVoid = true;//don't call this anymore
  8.  
  9.         //set the final position and rotation in case we're not completely there yet
  10.         _camera.transform.localRotation = Quaternion.Euler(goalRotation);
  11.         _camera.transform.localPosition = goalPosition;
  12.         return;
  13.     }
  14.  
  15.     float fTime = _TimeElapsed;//absolutely not sure about this one
  16.  
  17.     _camera.transform.localRotation = Quaternion.Lerp(_camera.transform.localRotation, Quaternion.Euler(goalRotation), fTime);
  18.     _camera.transform.localPosition = Vector3.Lerp(_camera.transform.localPosition, goalPosition, fTime);
  19. }
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