Пример #1
0
        public static void ConnectionGizmo(CurvySplineSegment cp)
        {
            Matrix4x4 mat = Gizmos.matrix;

            Gizmos.matrix = Matrix;

            Color c = Color.black;

            if (cp.ConnectionSyncPosition)
            {
                if (cp.ConnectionSyncRotation)
                {
                    c = Color.white;
                }
                else
                {
                    c = Color.red;
                }
            }
            else
            if (cp.ConnectionSyncRotation)
            {
                c = new Color(1, 1, 0);
            }

            Gizmos.color = c;
            Vector3 p = cp.transform.localPosition;

            Gizmos.DrawWireSphere(p, DTUtility.GetHandleSize(p) * CurvyGlobalManager.GizmoControlPointSize * 1.3f);
            Gizmos.matrix = mat;
        }
Пример #2
0
        public static void SegmentApproximationGizmo(CurvySplineSegment seg, Color col)
        {
            Matrix4x4 mat = Gizmos.matrix;

            Gizmos.matrix = Matrix;
            Gizmos.color  = col;
            Vector3 size = new Vector3(0.1f / seg.Spline.transform.localScale.x,
                                       0.1f / seg.Spline.transform.localScale.y,
                                       0.1f / seg.Spline.transform.localScale.z);

            for (int i = 0; i < seg.Approximation.Length; i++)
            {
                Vector3 p = seg.Approximation[i];
                Gizmos.DrawCube(p, DTUtility.GetHandleSize(p) * size);
            }
            Gizmos.matrix = mat;
        }
Пример #3
0
        public static void ControlPointGizmo(CurvySplineSegment cp, bool selected, Color col)
        {
            Matrix4x4 mat = Gizmos.matrix;

            Gizmos.matrix = Matrix4x4.identity;

            Gizmos.color = col;
            Vector3 p    = Matrix.MultiplyPoint(cp.transform.localPosition);
            float   size = (selected) ? 1 : 0.7f;

            if (cp.Spline.RestrictTo2D)
            {
                Gizmos.DrawCube(p, Vector3.one * DTUtility.GetHandleSize(p) * size * CurvyGlobalManager.GizmoControlPointSize);
            }
            else
            {
                Gizmos.DrawSphere(p, DTUtility.GetHandleSize(p) * size * CurvyGlobalManager.GizmoControlPointSize);
            }

            Gizmos.matrix = mat;
        }