Example #1
0
        void OnDrawGizmosSelected()
        {
            if (!debug)
            {
                return;
            }

            DynamicTree dt = physicsScene.dynamicTree;

            if (dt == null)
            {
                return;
            }

            for (int i = 0; i < dt.nodeCount; i++)
            {
                DTNode node = dt.nodes[i];
                if (i == dt.rootIndex)
                {
                    Handles.color = Color.white;
                }
                else if (node.IsLeaf())
                {
                    Handles.color = Color.green;
                }
                else
                {
                    Handles.color = Color.yellow;
                }
                Handles.DrawLine((Vector3)(node.aabb.min), (Vector3)(new FixVec3(node.aabb.max.x, node.aabb.min.y, 0)));
                Handles.DrawLine((Vector3)(new FixVec3(node.aabb.max.x, node.aabb.min.y, 0)), (Vector3)(node.aabb.max));
                Handles.DrawLine((Vector3)(node.aabb.max), (Vector3)(new FixVec3(node.aabb.min.x, node.aabb.max.y, 0)));
                Handles.DrawLine((Vector3)(new FixVec3(node.aabb.min.x, node.aabb.max.y, 0)), (Vector3)(node.aabb.min));
            }
        }