新增跟随相机

This commit is contained in:
YHH
2020-06-19 09:16:49 +08:00
parent b83b1a5b21
commit 981e149ca5
14 changed files with 509 additions and 31 deletions

View File

@@ -93,6 +93,11 @@ class Vector2 {
return Math.sqrt((this.x * this.x) + (this.y * this.y));
}
/** 对x和y值四舍五入 */
public round(): Vector2{
return new Vector2(Math.round(this.x), Math.round(this.y));
}
/**
* 创建一个新的Vector2
* 它包含来自另一个向量的标准化值。
@@ -124,6 +129,17 @@ class Vector2 {
return (v1 * v1) + (v2 * v2);
}
/**
*
* @param value1
* @param min
* @param max
*/
public static clamp(value1: Vector2, min: Vector2, max: Vector2){
return new Vector2(MathHelper.clamp(value1.x, min.x, max.x),
MathHelper.clamp(value1.y, min.y, max.y));
}
/**
* 包含指定向量的线性插值
* @param value1 第一个向量