circleToBox() public static method

works for circles whos center is in the box as well as just overlapping with the center out of the box.
public static circleToBox ( Circle circle, Box box, CollisionResult &result ) : bool
circle Circle First.
box Box Second.
result CollisionResult Result.
return bool
示例#1
0
        public override bool collidesWithShape(Shape other, out CollisionResult result)
        {
            if (other is Box && (other as Box).isUnrotated)
            {
                return(ShapeCollisions.circleToBox(this, other as Box, out result));
            }

            if (other is Circle)
            {
                return(ShapeCollisions.circleToCircle(this, other as Circle, out result));
            }

            if (other is Polygon)
            {
                return(ShapeCollisions.circleToPolygon(this, other as Polygon, out result));
            }

            throw new NotImplementedException(string.Format("Collisions of Circle to {0} are not supported", other));
        }