public override bool PointCollidesWithShape(Vector2 point, out CollisionResult result) { if (IsUnrotated) { return(ShapeCollisions.PointToBox(point, this, out result)); } return(base.PointCollidesWithShape(point, out result)); }
public override bool CollidesWithShape(Shape other, out CollisionResult result) { // special, high-performance cases. otherwise we fall back to Polygon. if (IsUnrotated && other is Box && (other as Box).IsUnrotated) { return(ShapeCollisions.BoxToBox(this, other as Box, out result)); } // TODO: get Minkowski working for circle to box //if( other is Circle ) // fallthrough to standard cases return(base.CollidesWithShape(other, out result)); }
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)); }
public override bool Overlaps(Shape other) { CollisionResult result; // Box is only optimized for unrotated if (other is Box && (other as Box).IsUnrotated) { return(Collisions.RectToCircle(ref other.bounds, position, Radius)); } if (other is Circle) { return(Collisions.CircleToCircle(position, Radius, other.position, (other as Circle).Radius)); } if (other is Polygon) { return(ShapeCollisions.CircleToPolygon(this, other as Polygon, out result)); } throw new NotImplementedException(string.Format("overlaps of Circle to {0} are not supported", other)); }
public override bool PointCollidesWithShape(Vector2 point, out CollisionResult result) { return(ShapeCollisions.PointToCircle(point, this, out result)); }
public override bool CollidesWithLine(Vector2 start, Vector2 end, out RaycastHit hit) { hit = new RaycastHit(); return(ShapeCollisions.LineToCircle(start, end, this, out hit)); }