docs: function(origin, direction) {
          // default parameters
          var comp = "obj",
              maxDistance = Infinity,
              sort = true;
          // optional arguments
          var argument, type;
          for (var i = 2, l = arguments.length; i < l; ++i) {
              argument = arguments[i];
              type = typeof argument;
              if (type === "number") maxDistance = argument + EPSILON;
              else if (type === "string")
                  // make it inclusive
                  comp = argument;
              else if (type === "boolean") sort = argument;
          }
  
          var ox = origin._x,
              oy = origin._y,
              dx = direction.x,
              dy = direction.y;
  
          var alreadyChecked = {},
              results = [];
  
          if (maxDistance < 0) {
              // find first intersection
  
              var closestObj = null,
                  minDistance = Infinity;
  
              // traverse map
              Crafty.map.traverseRay(origin, direction, function(
                  obj,
                  previousCellDistance
              ) {
                  // check if we advanced to next cell
                  //      then report closest object from previous cell
                  //          if intersection point is in previous cell
                  if (closestObj && minDistance < previousCellDistance) {
                      results.push({
                          obj: closestObj,
                          distance: minDistance,
                          x: ox + minDistance * dx,
                          y: oy + minDistance * dy
                      });
                      closestObj = null;
                      minDistance = Infinity;
  
                      return true;
                  }
  
                  // object must contain polygon hitbox, the specified component and must not already be checked
                  if (!obj.map || !obj.__c[comp] || alreadyChecked[obj[0]])
                      return;
                  alreadyChecked[obj[0]] = true;
  
                  // do exact intersection test
                  var distance = obj.map.intersectRay(origin, direction);
                  if (distance < minDistance) {
                      closestObj = obj;
                      minDistance = distance;
                  }
              });
  
              // in case traversal ended and we haven't yet pushed nearest intersecting object
              if (closestObj) {
                  results.push({
                      obj: closestObj,
                      distance: minDistance,
                      x: ox + minDistance * dx,
                      y: oy + minDistance * dy
                  });
              }
          } else {
              // find intersections up to max distance
  
              // traverse map
              Crafty.map.traverseRay(origin, direction, function(
                  obj,
                  previousCellDistance
              ) {
                  // check if we advanced to next cell
                  //      then cancel traversal if previousCellDistance > maxDistance
                  if (previousCellDistance > maxDistance) {
                      return true;
                  }
  
                  // object must contain polygon hitbox, the specified component and must not already be checked
                  if (!obj.map || !obj.__c[comp] || alreadyChecked[obj[0]])
                      return;
                  alreadyChecked[obj[0]] = true;
  
                  // do exact intersection test
                  var distance = obj.map.intersectRay(origin, direction);
                  if (distance < maxDistance) {
                      results.push({
                          obj: obj,
                          distance: distance,
                          x: ox + distance * dx,
                          y: oy + distance * dy
                      });
                  }
              });
          }
  
          if (sort)
              results.sort(function(a, b) {
                  return a.distance - b.distance;
              });
  
          return results;
      }