How to lerp between 2 Vectors in a certain time from outside an Update loop?

I’ve written my own networking implementation and I now get new Vector3 positions every 200 milliseconds for every player. (which might be a little bit too fast, dunno I’m quite new to networking)

My question is how do I lerp between the current vector3 position and the new vector3 position in exactly 200ms so that the movement seems smooth?

This is the piece of code that updates the position & rotation for a player:

public IEnumerator MovePlayer(string playerID, Vector3 newPos, Vector3 newRot) {
   players[playerID].transform.position = newPos;
   players[playerID].transform.eulerAngles = newRot;
   yield return null;
}

The MovePlayer() method only gets called once whenever an update from the server comes in so it isn’t called from an Update loop.

Thanks in advance!

One of the simplest ways is to get any free tweening script from the asset store.

DOTween, iTween both do what you want them to do, and are free (they also have paid versions).