title: XNA Matrix Camera Scale Issue in 2D Game
body: <p>I followed the tutorial on 
  <a href="http://www.david-amador.com/2009/10/xna-camera-2d-with-zoom-and-rotation/" rel="nofollow noreferrer">http://www.david-amador.com/2009/10/xna-camera-2d-with-zoom-and-rotation/</a> to achieve a camera that follows my player sprite with zoom in/out functionality.</p>
  
  <p>however, when I zoom in/out the camera seems to either slowly move away from the sprite whilst moving, I don't think I'm setting the position right, but I can't seem to figure out what it needs to be.</p>
  
  <p>Here's some snippets if it helps</p>
  
  <pre><code>  if (cam.Follow)
          {
              RectangleF temp = playerBoundingBox;
              cam.Pos = new Vector2(
                  (temp.X + temp.Width / 2)*cam.Zoom,
                 temp.Y + temp.Height / 2) * cam.Zoom;
          }
  
  
  
      public Matrix get_transformation(GraphicsDevice graphicsDevice)
      {
          _transform =
              // Add Zoom
                Matrix.CreateScale(
                 new Vector3((_zoom * _zoom * _zoom),
                                   (_zoom * _zoom * _zoom), 0))
              // Add Camera Rotation
               * Matrix.CreateRotationZ(_rotation)
              // Add Camera Position
               * Matrix.CreateTranslation(
                  new Vector3((graphicsDevice.Viewport.Width * 0.5f) - _pos.X,
                                   (graphicsDevice.Viewport.Height * 0.5f) - _pos.Y,
                                    0));
          return _transform;
      }
  </code></pre>
  
  <p>thank you in advance.</p>