Hello,
Try this;
#pragma strict
private var i : float = 0;
private var j : float = 0;
function Update ()
{
j += 0.01;//Makes "i" value decrease and increase 0.01 each frame, you can change it to any number you want
i = Mathf.PingPong(j, 2) - 1;
print(i);
}
Mathf.PingPong(t, length);
The "t" value must not be constant, that's why your variable keeps in some value.
↧