현재 지점에서 목표지점까지 이동한다.
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public Transform target; public float speed; void Update() { float step = speed * Time.deltaTime; transform.position = Vector3.MoveTowards(transform.position, target.position, step); } }
https://docs.unity3d.com/kr/530/ScriptReference/Vector3.MoveTowards.html