- Home /
Mathf loop between 2 floats?
Hello!
Does anyone know how to make two variables come and go in a determined time?
I tried Mathf.pingpong and Mathf.repeat but there was no result, what other way could I try? thanks!
ClutchTorque = Mathf.SmoothStep(MaxClutchTorque, MinClutchTorque, Time.maximumDeltaTime);
Comment
Best Answer
Answer by ShadyProductions · Mar 16, 2020 at 04:41 PM
You are probably looking for Mathf.Lerp
Combined with $$anonymous$$athf.PingPong
public float Duration = 5;
private float timer = 0;
void Update()
{
timer += Time.deltaTime;
float value = $$anonymous$$athf.Lerp(a, b, $$anonymous$$athf.PingPong(timer, Duration) / Duration);
}
Your answer
Follow this Question
Related Questions
Mathf repeat at the end? help! 1 Answer
Sound not looping properly on device? 2 Answers
How to add multiples variable ints from a foreach loop 1 Answer
How To Wrap A Blender Animation??? 1 Answer