void QueryBoxInBounds (RecastBBTreeBox box, Rect bounds, List<RecastMeshObj> boxes) {
if (box.mesh != null) {
//Leaf node
if (RectIntersectsRect(box.rect, bounds)) {
// Found a RecastMeshObj, add it to the result
boxes.Add(box.mesh);
}
} else {
#if ASTARDEBUG
Debug.DrawLine(new Vector3(box.rect.xMin, 0, box.rect.yMin), new Vector3(box.rect.xMax, 0, box.rect.yMin), Color.white);
Debug.DrawLine(new Vector3(box.rect.xMin, 0, box.rect.yMax), new Vector3(box.rect.xMax, 0, box.rect.yMax), Color.white);
Debug.DrawLine(new Vector3(box.rect.xMin, 0, box.rect.yMin), new Vector3(box.rect.xMin, 0, box.rect.yMax), Color.white);
Debug.DrawLine(new Vector3(box.rect.xMax, 0, box.rect.yMin), new Vector3(box.rect.xMax, 0, box.rect.yMax), Color.white);
#endif
//Search children
if (RectIntersectsRect(box.c1.rect, bounds)) {
QueryBoxInBounds(box.c1, bounds, boxes);
}
if (RectIntersectsRect(box.c2.rect, bounds)) {
QueryBoxInBounds(box.c2, bounds, boxes);
}
}
}