summaryrefslogtreecommitdiff
path: root/Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs')
-rw-r--r--Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs b/Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs
new file mode 100644
index 0000000..1ead7ff
--- /dev/null
+++ b/Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs
@@ -0,0 +1,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);
+ }
+
+}