title: Box2dx: Usage of World.QueryAABB?
body: <p>I'm using Box2dx with C#/XNA. I'm trying to write a function that determines if a body could exist in a given point without colliding with anything:</p>
  
  <pre><code>    /// &lt;summary&gt;
      /// Can gameObject exist with start Point without colliding with anything?
      /// &lt;/summary&gt;
      internal bool IsAvailableArea(GameObjectModel model, Vector2 point)
      {
          Vector2 originalPosition = model.Body.Position;
          model.Body.Position = point; // less risky would be to use a deep clone
  
          AABB collisionBox;
          model.Body.GetFixtureList().GetAABB(out collisionBox);
  
          // how is this supposed to work?
          physicsWorld.QueryAABB(x =&gt; true, ref collisionBox);
  
          model.Body.Position = originalPosition;
          return true;
      }
  </code></pre>
  
  <p>Is there a better way to go about doing this? How is <code>World.QueryAABB</code> supposed to work?</p>
  
  <p>Here is an earlier attempt. It is broken; it always returns false.</p>
  
  <pre><code>    /// &lt;summary&gt;
      /// Can gameObject exist with start Point without colliding with anything?
      /// &lt;/summary&gt;
      internal bool IsAvailableArea(GameObjectModel model, Vector2 point)
      {
          Vector2 originalPosition = model.Body.Position;
          model.Body.Position = point; // less risky would be to use a deep clone
  
          AABB collisionBox;
          model.Body.GetFixtureList().GetAABB(out collisionBox);
  
          ICollection&lt;GameObjectController&gt; gameObjects = worldQueryEngine.GameObjectsForPredicate(x =&gt; ! x.Model.Passable);
  
          foreach (GameObjectController controller in gameObjects)
          {
              AABB potentialCollidingBox;
              controller.Model.Body.GetFixtureList().GetAABB(out potentialCollidingBox);
  
              if (AABB.TestOverlap(ref collisionBox, ref potentialCollidingBox))
              {
                  model.Body.Position = originalPosition;
                  return false; // there is something that will collide at this point
              }
          }
          model.Body.Position = originalPosition;
          return true;
      }
  </code></pre>