由於transform.rotation是 Quaternion類型,並不能像transform.position一樣通過直接給rotation賦值Vector3(X,Y,Z),但是通過transform.localEulerAngles我們可以直接改變rotation的值,如transform.localEulerAngles = new Vector3(X, Y, Z);其中X,Y,Z代表角度。
Ps.unity新手,如有錯誤請在評論指正。感謝。
由於transform.rotation是 Quaternion類型,並不能像transform.position一樣通過直接給rotation賦值Vector3(X,Y,Z),但是通過transform.localEulerAngles我們可以直接改變rotation的值,如transform.localEulerAngles = new Vector3(X, Y, Z);其中X,Y,Z代表角度。
Ps.unity新手,如有錯誤請在評論指正。感謝。
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。