Exemple #1
0
    void OnDrawGizmos()
    {
        m_bvh = new BVH <GameObject>();
        for (int i = 0; i < transform.childCount; i++)
        {
            var e = transform.GetChild(i).GetComponent <BoxCollider>();
            if (e == null)
            {
                continue;
            }

            var  bounds = e.bounds;
            AABB box    = new AABB()
            {
                min = bounds.min, max = bounds.max
            };
            Item <GameObject> item = new Item <GameObject>(e.gameObject, box);
            m_bvh.Insert(item);
        }

        Gizmos.color = Color.white;
        DrawNode(m_bvh.Root);
    }