把以下代碼綁定到要旋轉的物體,具體要圍繞x,y,z 哪個軸旋轉就改相應的值即可。
using UnityEngine;
using System.Collections;
public class PickUp : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.Rotate(new Vector3(0,1,0)); //繞y軸旋轉
}
}