新增raycast射线
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/** 返回它的长度 */
|
||||
|
||||
Reference in New Issue
Block a user