射线检测完善

This commit is contained in:
yhh
2020-08-03 14:45:57 +08:00
parent a4fe9f5798
commit 8e3bcc1257
14 changed files with 814 additions and 53 deletions

View File

@@ -219,6 +219,13 @@ module es {
return Math.sqrt((this.x * this.x) + (this.y * this.y));
}
/**
* 返回其长度的平方
*/
public lengthSquared(): number {
return (this.x * this.x) + (this.y * this.y);
}
/** 对x和y值四舍五入 */
public round(): Vector2 {
return new Vector2(Math.round(this.x), Math.round(this.y));