unity中的萬向節鎖具體體現

之前寫過一篇關於萬向節鎖的文章(http://blog.csdn.net/lj820348789/article/details/48264049),當然,那都是理論上的,下面來看看在實戰中遇到的萬向節鎖問題,代碼如下:

public class Rotation : MonoBehaviour {
	// Use this for initialization
	void Start () {
        this.transform.rotation = Quaternion.AngleAxis(10, new Vector3(1, 0, 0));
        this.transform.rotation = Quaternion.AngleAxis(90, new Vector3(0, 1, 0)) * transform.rotation;
        this.transform.rotation = Quaternion.AngleAxis(100, new Vector3(0, 0, 1)) * transform.rotation;

	}
	
	// Update is called once per frame
	void Update () {
	    
	}
}

運行之後,得到如下結果:


可以看到,z軸向是沒有旋轉的。

發佈了39 篇原創文章 · 獲贊 17 · 訪問量 12萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章