Esempio n. 1
0
        public static float GetHandleSize(Vector3 center)
        {
#if UNITY_EDITOR
            if (IsHandleHackAvailable)
            {
                return(HandleUtility.GetHandleSize(center));
            }
            else
#endif
            return(1f);
        }
Esempio n. 2
0
        public static void DrawAngleBetween(Vector3 center, Vector3 from, Vector3 to, Vector3 axis, float radius, Color color, bool constantScreenSize = true, bool label = false)
        {
#if UNITY_EDITOR
            if (IsHandleHackAvailable)
            {
                float angle = Vector3.SignedAngle(from, to, axis);
                DrawArc(center, axis, from, angle, radius, color, constantScreenSize);
                if (label)
                {
                    float   factor   = constantScreenSize ? HandleUtility.GetHandleSize(center) : 1f;
                    Vector3 labelPos = center + (Vector3.Lerp(from, to, 0.5f) * factor);
                    DrawLabel(labelPos, $"{angle:F2}");
                }
            }
#endif
        }
Esempio n. 3
0
        public static void DrawArc(Vector3 center, Vector3 normal, Vector3 from, float angle, float radius, Color color, bool constantScreenSize = true)
        {
#if UNITY_EDITOR
            if (IsHandleHackAvailable)
            {
                if (constantScreenSize)
                {
                    radius *= HandleUtility.GetHandleSize(center);
                }
                using (new HandleColorScope(color))
                {
                    Handles.DrawSolidArc(center, normal, from, angle, radius);
                }
            }
#endif
        }