Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Trying to use coroutines in order to use Mathf.Lerp, Lerp instantly jumps values

$
0
0
What am I doing wrong? function scalePlayer(scaleTo : float, timeUp : float, timeDown : float) { StopCoroutine("scaleTo"); StopCoroutine("scaleBack"); StartCoroutine(scaleTo(scaleTo, timeUp)); yield WaitForSeconds(timeUp); StartCoroutine(scaleBack(scaleTo, timeDown)); } function scaleTo(scaleTo : float, timeUp : float) { player.transform.localScale = new Vector3(Mathf.Lerp(objectScale[0], scaleTo, Time.deltaTime/timeUp), Mathf.Lerp(objectScale[1], scaleTo, Time.deltaTime/timeUp), 0); yield; } function scaleBack(scaleTo : float, timeDown : float) { player.transform.localScale = new Vector3(Mathf.Lerp(scaleTo, objectScale[0], Time.deltaTime/timeDown), Mathf.Lerp(scaleTo, objectScale[1], Time.deltaTime/timeDown), 0); yield; }

Viewing all articles
Browse latest Browse all 1875

Latest Images

Trending Articles



Latest Images

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