Should I use Time.deltaTime several times in one function?

I have this piece of code that reads the current user input, and then applies it to a transform.

My question is: when I tween the input value I multiply by Time.deltaTime (because this is in the documentation for Mathf.MoveTowards).

Then, when I apply it to the transform, I use Time.deltaTime again!

Is it needed to multiply by Time.deltaTime twice? Won’t that make everything twice as slow as it should be?

// input is -1, 0 or 1
float inputValue = controls.Driving.Speed.ReadValue<float>();

// interpolate the value, here I use Time.deltaTime
currentValue = Mathf.MoveTowards(inputValue, currentValue, 0.25f * Time.deltaTime);

// apply to transform also uses Time.deltaTime
transform.Translate(Vector3.forward * Time.deltaTime * currentValue * speed);

currentValue is counting to accelerate user input? and then Translate is actually moving so I believe you would need it in both instances.

2 Likes