Ejemplo n.º 1
0
 public static void DrawCapsule(Vector3 capA, Vector3 capB, float radius)
 {
     if (radius != 0f)
     {
         float single = Vector3.Distance(capA, capB);
         if (single != 0f)
         {
             VisGizmosUtility.PushMatrix();
             Matrix4x4 matrix4x4 = Matrix4x4.TRS(capA, VisGizmosUtility.MagicFlat(capA, capB), new Vector3(radius, radius, radius)) * Gizmos.matrix;
             Gizmos.matrix = matrix4x4;
             float single1 = single / radius;
             VisGizmosUtility.DrawFlatCapsule(single1);
             Gizmos.matrix = VisGizmosUtility.ninetyZ * matrix4x4;
             VisGizmosUtility.DrawFlatCapsule(single1);
             Gizmos.matrix = VisGizmosUtility.ninetyY * Gizmos.matrix;
             VisGizmosUtility.DrawFlatCircle();
             Gizmos.matrix = VisGizmosUtility.ninetyY * matrix4x4;
             VisGizmosUtility.DrawFlatCircle();
             VisGizmosUtility.PopMatrix();
         }
         else
         {
             VisGizmosUtility.DrawSphere(capA, radius);
         }
     }
     else
     {
         Gizmos.DrawLine(capA, capB);
     }
 }
Ejemplo n.º 2
0
 public static void DrawCircle(Vector3 origin, Vector3 axis, float radius)
 {
     VisGizmosUtility.PushMatrix();
     Gizmos.matrix = Matrix4x4.TRS(origin, Quaternion.LookRotation(axis), new Vector3(radius, radius, 1f)) * Gizmos.matrix;
     VisGizmosUtility.DrawFlatCircle();
     VisGizmosUtility.PopMatrix();
 }
Ejemplo n.º 3
0
    public static void DrawSphere(Vector3 center, float radius, Quaternion rotation)
    {
        VisGizmosUtility.PushMatrix();
        Matrix4x4 matrix4x4 = Matrix4x4.TRS(center, rotation, new Vector3(radius, radius, radius)) * Gizmos.matrix;

        Gizmos.matrix = matrix4x4;
        VisGizmosUtility.DrawFlatCircle();
        Gizmos.matrix = VisGizmosUtility.ninetyX * matrix4x4;
        VisGizmosUtility.DrawFlatCircle();
        Gizmos.matrix = VisGizmosUtility.ninetyY * matrix4x4;
        VisGizmosUtility.DrawFlatCircle();
        VisGizmosUtility.PopMatrix();
    }
Ejemplo n.º 4
0
 public static void DrawFlatCircle(float radius)
 {
     VisGizmosUtility.PushMatrixMul(Matrix4x4.Scale(Vector3.one * radius));
     VisGizmosUtility.DrawFlatCircle();
     VisGizmosUtility.PopMatrix();
 }
Ejemplo n.º 5
0
    public static void DrawDotCone(Vector3 position, Vector3 forward, float length, float arc, float back)
    {
        int       num;
        float     single;
        float     single1;
        Matrix4x4 matrix4x4;

        if (arc != 1f)
        {
            float single2 = Mathf.Ceil(length);
            if (single2 != 0f)
            {
                float single3 = Mathf.Acos(arc);
                int   num1    = Mathf.Abs((int)single2);
                float single4 = length / single2;
                float single5 = single4 * single3;
                if (back != 0f)
                {
                    single2 = 0f;
                    num     = 0;
                    single  = single3 * back;
                    single1 = single;
                }
                else
                {
                    single2 = single4;
                    num     = 1;
                    single  = single5;
                    single1 = 0f;
                }
                VisGizmosUtility.PushMatrixMul(Matrix4x4.TRS(position, Quaternion.LookRotation(forward), Vector3.one), out matrix4x4);
                Vector3 vector3  = new Vector3(single1, 0f, 0f);
                Vector3 vector31 = new Vector3(single1 + single3 * length, 0f, length);
                Gizmos.DrawLine(vector3, vector31);
                vector3.x  = -vector3.x;
                vector31.x = -vector31.x;
                Gizmos.DrawLine(vector3, vector31);
                vector3.y  = vector3.x;
                vector3.x  = 0f;
                vector31.y = vector31.x;
                vector31.x = 0f;
                Gizmos.DrawLine(vector3, vector31);
                vector3.y  = -vector3.y;
                vector31.y = -vector31.y;
                Gizmos.DrawLine(vector3, vector31);
                while (num <= num1)
                {
                    Gizmos.matrix = matrix4x4 * Matrix4x4.TRS(new Vector3(0f, 0f, single2), Quaternion.identity, new Vector3(single, single, 1f));
                    VisGizmosUtility.DrawFlatCircle();
                    num++;
                    single2 = single2 + single4;
                    single  = single + single5;
                }
                VisGizmosUtility.PopMatrix();
            }
        }
        else
        {
            Gizmos.DrawLine(position, position + (forward * length));
        }
    }