This takes 4.6 seconds to complete. I want it to take 1.0 seconds - like I put in the function.
cur, to, and vel are not altered anywhere.
What have I done wrong?
#pragma strict
var from : float;
var to : float = 10;
var time : float = 1;
private var vel : float;
private var cur : float;
private var amntTime : float;
function Start () {
cur = from;
vel = 0;
}
function Update () {
amntTime += Time.deltaTime;
cur = Mathf.SmoothDamp(cur,to,vel,time);
if ( Mathf.Abs(cur-to) < 0.01 ) {
Debug.Log("Took " + amntTime);
gameObject.active = false;
}
}
I was using deltaTime, which has the same results as this convoluted thing. Just trying to see if somehow the coroutine was getting the wrong deltaTime.