UnityEditor.RectHandles.DrawImageBasedCap C# (CSharp) Method

DrawImageBasedCap() private static method

private static DrawImageBasedCap ( int controlID, Vector3 position, Quaternion rotation, float size, GUIStyle normal, GUIStyle active ) : void
controlID int
position Vector3
rotation UnityEngine.Quaternion
size float
normal UnityEngine.GUIStyle
active UnityEngine.GUIStyle
return void
        private static void DrawImageBasedCap(int controlID, Vector3 position, Quaternion rotation, float size, GUIStyle normal, GUIStyle active)
        {
            if ((Camera.current == null) || (Vector3.Dot(position - Camera.current.transform.position, Camera.current.transform.forward) >= 0f))
            {
                Vector3 vector = (Vector3) HandleUtility.WorldToGUIPoint(position);
                Handles.BeginGUI();
                float fixedWidth = normal.fixedWidth;
                float fixedHeight = normal.fixedHeight;
                Rect rect = new Rect(vector.x - (fixedWidth / 2f), vector.y - (fixedHeight / 2f), fixedWidth, fixedHeight);
                if (GUIUtility.hotControl == controlID)
                {
                    active.Draw(rect, GUIContent.none, controlID);
                }
                else
                {
                    normal.Draw(rect, GUIContent.none, controlID);
                }
                Handles.EndGUI();
            }
        }

Usage Example

示例#1
0
 public static void PivotCap(int controlID, Vector3 position, Quaternion rotation, float size)
 {
     if (RectHandles.s_Styles == null)
     {
         RectHandles.s_Styles = new RectHandles.Styles();
     }
     RectHandles.DrawImageBasedCap(controlID, position, rotation, size, RectHandles.s_Styles.pivotdot, RectHandles.s_Styles.pivotdotactive);
 }
All Usage Examples Of UnityEditor.RectHandles::DrawImageBasedCap