Vector3 Lerp using Time.deltaTime?

Hello guys, i’m making my own character controller and physics, and currently, the final line of my script is just like this:

myTransform.position = Vector3.Lerp(myTransform.position,(myTransform.position + (myTransform.rotation * finalmovement)),0.8);

that finalmovement is a Vector3 that i get after calculating the physics and player inputs, to see where the character is gonna move.
The problem comes in the last part of the line, where i have to put the “time”. Currently, i’m not usign Time.deltaTime, and its working fine, if I creaty a build and play it, the movement is smooth, and even if i test in other PCs, the movement continues the same. That’s nice. In the editor mode, however, its not smooth and sometimes its gets very laggy. That’s bad, because I have to test everything via build & run.

I tried using Time.deltaTime, but the movement differs greatly from the editor and the build.
using for exemple, 40 * Time.deltaTime, in the editor, the character moves very fast, but in the build, it barely moves.

Can someone explain me why this happens? I tought using Time.deltaTime would give the same results, independent of the frame rate ( that is slower in the editor ).

And wich one is best when making this kind of precise movement?

Thanks in advance!

Acutally, i do use Time.deltaTime in my code, but not on the Lerp itself
I use time.deltaTime to “find” the values, something like this:
finalmovement.y -= gravity * Time.deltaTime

and after that i do the lerp without Time.deltaTime

does will guarantee me that the speed is the same in every computer?

I always use this with and have never had any problems. Yes it will be dodgy without it because the speed will depend on the frame rate.

myTransform.position = Vector3.Lerp(myTransform.position,(myTransform.position + (myTransform.rotation * finalmovement)),something * Time.deltaTime);

Your problem will be something else in your code.

I have a few suggestions, since I think I’d need to see more of your code to really know what’s what.

  1. Time.deltaTime is immensely important. If you have a code that moves your character forward and you want the speed to be 5 units per second, the only way to make that work on all builds is to multiply it by Time.deltaTime so it only moves the appropriate amount each frame.

  2. Try using the built-in controllers. Rebuilding the wheel is usually a bad idea and will cause problems. Once you use the basic ones that are built in, try manipulating/customizing it from there.

You are mistaking Lerp for SmoothDamp. The two are not interchangeable.