Exemple #1
0
 // Update is called once per frame
 void LateUpdate()
 {
     if (transitionTimer.IsStarted && !transitionTimer.Timeout())
     {
         float coef = transitionLook.Evaluate(transitionTimer.Progress);
         transform.position = Vector3.Lerp(transform.position, target.GetPosition(), coef);
         transform.rotation = Quaternion.Lerp(transform.rotation, target.GetRotation(), coef);
     }
     else if (!isSnapped && !target.isSnapped)
     {
         transform.position = Vector3.Lerp(transform.position, target.GetPosition(), target.positionSpeed * Time.deltaTime);
         transform.rotation = Quaternion.Lerp(transform.rotation, target.GetRotation(), target.rotationSpeed * Time.deltaTime);
     }
     else
     {
         transform.position = target.GetPosition();
         transform.rotation = target.GetRotation();
     }
 }