Пример #1
0
        public static RaycastHit2D[] LinecastAllWithWidthAndOrder(Vector2 start, Vector2 end, float width, int layerMask)
        {
            LineSegment2D       lineSegment = new LineSegment2D(start, end);
            List <RaycastHit2D> hits        = new List <RaycastHit2D>();
            RaycastHit2D        hit;

            do
            {
                hit = LinecastWithWidth(lineSegment.start, end, width, layerMask);
                if (hit.collider != null)
                {
                    lineSegment.start = lineSegment.GetPointWithDirectedDistance(lineSegment.GetDirectedDistanceAlongParallel(hit.point));
                    hits.Add(hit);
                }
            } while (hit.collider != null);
            return(hits.ToArray());
        }