Unity Gizmos/Handles.DrawWireCube 如何設置旋轉?

話不多說直接上例子

				Transform center = target;
                Matrix4x4 oldMat = Handles.matrix;
                //獲取目標旋轉矩陣
                Matrix4x4 rotationMat = center.localToWorldMatrix;
                //設置當前爲旋轉矩陣
                Handles.matrix = rotationMat;
                {
                    //這裏的center是相對目標中心而言,因爲旋轉cube與目標位置相同所以是zero
                    Handles.DrawWireCube(center: Vector3.zero, size: center.scale);
                }
                //重置當前矩陣
                Handles.matrix = oldMat;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章