title: Multiple Raycasting for line of sight
body: <p>I'm trying to find my way around box2d and I am unsure about my approach to do line of sight detection using raycast callbacks. </p>
  
  <pre><code> private RayCastCallback callback = new RayCastCallback() {
          @Override
          public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 Normal, float fraction) {
              collision.set(point);
  
              lineOfSight.addLast(fixture);
  
              if (fixture.getFilterData().categoryBits != BIT_PLAYER) {
                  System.out.println("ray hit wall");
                  return fraction;}
              else if (fixture.getFilterData().categoryBits == BIT_PLAYER) {
                  System.out.println("player found");
  
                  return fraction;
              }
  
              return 0;
          }
  </code></pre>
  
  <p>Above is my callback method which is called through :</p>
  
  <pre><code>       world.rayCast(callback, startp, endp);
  </code></pre>
  
  <p>The above line is in the update method and called continuously. </p>
  
  <p>Now the problem is that I have multiple objects doing this raycast, so what happens is that fixtures are added into a queue on contact and there is some code in update method that checks if the first item in the queue is player. If it is a player, projectile is fired. </p>
  
  <pre><code>  if (lineOfSight.first().getFilterData().categoryBits == BIT_PLAYER) {
                     lineOfSight = new Queue&lt;Fixture&gt;();
                     createBullet();
                 } else {
                     lineOfSight.clear();
                 }
  </code></pre>
  
  <p>All of these seem a bit messy and is not fully working either because I have multiple bodies ray casting and using the callback method. </p>
  
  <p>Is there a more efficient way of doing this or maybe somehow edit the reportRayFixtue method? I can't think of a way to edit the parameters:(
  Thank you for your time.</p>