summaryrefslogtreecommitdiff
path: root/Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs
blob: 1ead7ffc6c54c3eb4c35c97ebccdab85044d1d55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);
    }

}