Bounds TranslateBounds(Bounds b)
{
Vector3 size;
b.center = transform.rotation * b.center + transform.position;
size = transform.rotation * b.size;
// rotating a size by an arbitrary Quaternion can result
// in negative sizes, which will make the bounds checks fail.
size.x = Mathf.Abs(size.x);
size.y = Mathf.Abs(size.y);
size.z = Mathf.Abs(size.z);
b.size = size;
return b;
}