新增raycast射线

This commit is contained in:
yhh
2020-07-31 17:17:44 +08:00
parent 514572f291
commit 40fe7a57db
13 changed files with 1182 additions and 813 deletions

View File

@@ -71,7 +71,7 @@ module es {
}
/**
* 是否与另一个矩形相交
* 如果其他相交矩形返回true
* @param value
*/
public intersects(value: egret.Rectangle) {
@@ -91,6 +91,10 @@ module es {
(value.y < (this.y + this.height)));
}
public contains(x: number, y: number): boolean{
return ((((this.x <= x) && (x < (this.x + this.width))) && (this.y <= y)) && (y < (this.y + this.height)));
}
public getHalfSize() {
return new Vector2(this.width * 0.5, this.height * 0.5);
}

View File

@@ -211,6 +211,7 @@ module es {
let val = 1 / Math.sqrt((this.x * this.x) + (this.y * this.y));
this.x *= val;
this.y *= val;
return this;
}
/** 返回它的长度 */