Example #1
0
    public bool intersectsRadius(Vector2 position, float radius)
    {
        Vector2[] points = new Vector2[] {
            new Vector2(x, y),
            new Vector2(x + width, y),
            new Vector2(x, y+ height),
            new Vector2(x + width, y + height)
        };

        /*foreach (Vector2 point in points)
        {
            if (position.DistTo(point) < radius)
            {
                return true;
            }
        }*/

        if(position.WithinRadius(points[0], points[3], radius))
        {
            return true;
        }

        return false;
    }