public float Speed;
Quaternion targetAngels;
public GameObject gam;
// Use this for initialization
void Start () {
targetAngels = Quaternion.Euler(90, 0, 0);
}
private void OnTriggerStay(Collider other)
{
if (other.gameObject.name == "Sphere")
{
//速度隨旋轉角度的接近減慢
this.gameObject.transform.rotation = Quaternion.Slerp(transform.rotation, targetAngels, Speed * Time.deltaTime);
//速度恆定旋轉
this.gameObject.transform.rotation = Quaternion.RotateTowards(transform.rotation, targetAngels, Speed * Time.deltaTime);
}
}