IEnumerator StepByStepMementoRecovery(GrabbedMemento memento) { float passedTime = 0; _rb.isKinematic = true; while (Vector3.Distance(transform.position, memento.position) > .01f) { transform.position = Vector3.Lerp(transform.position, memento.position, passedTime); yield return(null); passedTime += Time.deltaTime; } _rb.isKinematic = false; }
public void SetMemento(GrabbedMemento memento) { transform.rotation = memento.rotation; StartCoroutine(StepByStepMementoRecovery(memento)); }