Unity3d LookAt參數說明

Unity3d LookAt參數說明 

//
        // 摘要: 
        //     Rotates the transform so the forward vector points at target's current position.
        //
        // 參數: 
        //   target:
        //     Object to point towards.
        //
        //   worldUp:
        //     Vector specifying the upward direction.
        public void LookAt(Transform target, Vector3 worldUp);

其中 target爲朝向的目標,worldUp爲對象朝向目標後旋轉自身,使得worldUp垂直z軸向上;

transform.LookAt(target,transform.right);	

transform.LookAt(target,-transform.right);	

transform.LookAt(target,transform.up);	

transform.LookAt(target,-transform.up);	

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章