- Home /
Question by
DeadlyCool · Jun 05, 2015 at 05:05 PM ·
timechangemathfsmoothdamp
SmoothDamp keeps changing back
So I have a piece of code which changes the saturation of Image Effect's Color correction curve saturation. I have a min and a max value. I have put all the stuff into a smoothdamp code, but for some reason when I start the game, the saturation slider keeps staying at about 1.44053 or something like that, and jumps around that value, sometimes getting up to 2. Here's the code:
public float saturation = 0.0f;
private float velocity = 0.5f;
//some native script stuff
void Update() {
saturation = Mathf.SmoothDamp (0.0f, 5.0f, ref velocity, 0.1f); //This code
}
The desired result though is a smooth change of the saturation over a period of time which goes from 0 to 5 and vice versa, looped. Thanks in advance!
Comment