// Update is called once per frame void Update() { if (began) { Vector3 direction = targetPosition.position - transform.position; spotlight.MoveTowards(direction.XZ(), speed); if (direction.XZ().magnitude < 0.1f) { NewPosition(); } } }