修复boxcollider碰撞问题
This commit is contained in:
@@ -1,16 +1,7 @@
|
||||
class RectangleExt {
|
||||
public static union(first: Rectangle, point: Vector2){
|
||||
let rect = new Rectangle(point.x, point.y, 0, 0);
|
||||
return this.unionR(first, rect);
|
||||
}
|
||||
|
||||
public static unionR(value1: Rectangle, value2: Rectangle){
|
||||
let result = new Rectangle();
|
||||
result.x = Math.min(value1.x, value2.x);
|
||||
result.y = Math.min(value1.y, value2.y);
|
||||
result.width = Math.max(value1.right, value2.right) - result.x;
|
||||
result.height = Math.max(value1.bottom, value2.bottom) - result.y;
|
||||
|
||||
return result;
|
||||
let rectResult = first.union(rect);
|
||||
return new Rectangle(rectResult.x, rectResult.y, rectResult.width, rectResult.height);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user