title: XNA Scale BoundingBox
body: <p>I am working on a class for a button.
  The idea is that the button calculates the size of the text and then scale itself accordingly. </p>
  
  <pre><code>float X = font.MeasureString(text).X;
  float Y = font.MeasureString(text).Y;
  float x = 1.0f + (X / buttonTexture.Width);
  float y = 1.0f + (Y / buttonTexture.Height);
  scale = new Vector2(x,y);
  </code></pre>
  
  <p>This code works great. </p>
  
  <p>I am using BoundingBoxes to check the collision. However, how do I take into account the scale poistion when creating the bounding box?</p>
  
  <p>So far I have:</p>
  
  <pre><code>BoundingBox buttonBox = new BoundingBox(new Vector3(location, 0), new Vector3(location.X  + buttonTexture.Width, location.Y  + buttonTexture.Height, 0));
  </code></pre>
  
  <p>I've tried multiplying the lower-right point of the boundingbox by the scale:</p>
  
  <pre><code>BoundingBox buttonBox = new BoundingBox(new Vector3(location, 0), new Vector3((location.X  + buttonTexture.Width * scale.X), (location.Y  + buttonTexture.Height) * scale.Y, 0));
  </code></pre>
  
  <p>But the collision was occurring miles from the button</p>
  
  <p>Thanks in advance.</p>