xnapunk.colliders.RectangleCollider.IntersectsLine C# (CSharp) Method

IntersectsLine() public method

public IntersectsLine ( Vector2 start, Vector2 end, float lineWidth ) : bool
start Vector2
end Vector2
lineWidth float
return bool
        public override bool IntersectsLine(Vector2 start, Vector2 end, float lineWidth)
        {
            if (IntersectsPoint(start) || IntersectsPoint(end)) return true;

            Vector2 tL = GetTopLeft();
            Vector2 tR = GetTopRight();
            Vector2 bL = GetBottomLeft();
            Vector2 bR = GetBottomRight();

            return Collider.LinesIntersect(start, end, tL, tR) || Collider.LinesIntersect(start, end, tR, bR) || Collider.LinesIntersect(start, end, bL, bR) || Collider.LinesIntersect(start, end, bL, tL);
        }