Quantcast
Viewing latest article 18
Browse Latest Browse All 72

Answer by TobiasP

private bool eventHappened; void Update() { if(eventHappened) { eventHappened = false; StartCoroutine(Lerp()); } } private IEnumerator Lerp() { while(true) { this.transform.position = Vector3.Lerp(this.transform.position, Vector3.zero, Time.deltaTime * 10); // We are at the position, stop this IEnumerator if(Mathf.Approximately(this.transform.position.x, 0) && Mathf.Approximately(this.transform.position.y, 0)) { return false; } yield return new WaitForEndOfFrame(); } } Hope this helps!!

Viewing latest article 18
Browse Latest Browse All 72

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>