title: C# How to make a bounds fit to a Camera that is rotated
body: <p>In Unity I have a class that is creating a new bounds, for those of you who may not know unity bounds is just really a cube. I then have a object like a Camera, I want to add this bounds to the camera and scale it to fit around the view frustum.  That would be easy if it never rotated but the camera does rotate and at the moment I am drawling a blank.</p>
  
  <p>this is what I have right now witch works when the Camera does not rotate</p>
  
  <pre><code>    float h = Mathf.Tan(cam.fov * Mathf.Deg2Rad * .5f) * cam.farClipPlane * 2;
      Vector3 scale = new Vector3(h * cam.aspect, h, cam.farClipPlane);
  
      newBounds.center = cam.transform.position + cam.transform.forward * (cam.farClipPlane/2);
      newBounds.size = scale; 
  </code></pre>