Esempio n. 1
0
    void DrawDebugLines()
    {
        Mesh           m           = new Mesh();
        List <Vector3> meshVerts   = new List <Vector3>();
        List <int>     meshIndices = new List <int>();

        //quadtree init
        QuadTreeNode <int> .Init(Vector3.zero, Vector2.one *Ground.Instance.transform.localScale.x, 0);

        for (int i = 0; i < indices.Length - 2; i += 3)
        {
            var i0 = indices[i];
            var i1 = indices[i + 1];
            var i2 = indices[i + 2];

            var v0 = vertices[i0];
            var v1 = vertices[i1];
            var v2 = vertices[i2];

            LineDrawerMgr.DrawLine(v0, v1);
            LineDrawerMgr.DrawLine(v1, v2);
            LineDrawerMgr.DrawLine(v2, v0);

            QuadTreeNode <int> .Root.Insert(v0, i);

            if (i == 0)
            {
                meshVerts.Add(v0);
                meshVerts.Add(v1);
                meshVerts.Add(v2);
                meshIndices.Add(i0);
                meshIndices.Add(i1);
                meshIndices.Add(i2);
            }
        }

        CommonUtils.DrawLine(v2, v1);
    }
 public static void DrawLine(Vector3 v1, Vector3 v2, Color?color = null, float consistTime = 0)
 {
     LineDrawerMgr.DrawLine(v1, v2, color, consistTime);
 }
 public static void DrawTriangle(Vector3 v1, Vector3 v2, Vector3 v3, Color?color = null, float consistTime = 0, float lineSize = 0.2f)
 {
     LineDrawerMgr.DrawLine(v1, v2, color, consistTime, lineSize);
     LineDrawerMgr.DrawLine(v2, v3, color, consistTime, lineSize);
     LineDrawerMgr.DrawLine(v3, v1, color, consistTime, lineSize);
 }