using UnityEngine;
using System.Collections;
public class test : MonoBehaviour
{
public float angleSpeed = 0.01f;
public Transform target;
public bool isRotate = true;
void Update()
{
if (isRotate)
{
Vector3 vec = (target.position - transform.position);
Quaternion rotate = Quaternion.LookRotation(vec);
transform.localRotation = Quaternion.Slerp(transform.localRotation, rotate, angleSpeed);
if (Vector3.Angle(vec, transform.forward) < 0.1f)
{
isRotate = false;
}
}
}
}