box重载overlaps
This commit is contained in:
@@ -21,6 +21,22 @@ class Box extends Polygon {
|
||||
return verts;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param other
|
||||
*/
|
||||
public overlaps(other: Shape){
|
||||
if (this.isUnrotated){
|
||||
if (other instanceof Box && other.isUnrotated)
|
||||
return this.bounds.intersects(other.bounds);
|
||||
|
||||
if (other instanceof Circle)
|
||||
return Collisions.isRectToCircle(this.bounds, other.position, other.radius);
|
||||
}
|
||||
|
||||
return super.overlaps(other);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param other
|
||||
|
||||
Reference in New Issue
Block a user