using System.Collections; using System.Collections.Generic; using UnityEngine; public class SmoothMove : MonoBehaviour { public Vector3 from; public Vector3 to; public float speed; float time; private void Update() { time += Time.deltaTime * speed; transform.position = Vector3.Lerp(from, to, Mathf.PingPong(time, 10) / 10.0f); } }