优化collision

This commit is contained in:
YHH
2020-06-15 08:46:38 +08:00
parent 246e9a9511
commit 7f8f1cf0d0
8 changed files with 132 additions and 7 deletions

View File

@@ -17,4 +17,13 @@ class Vector2Ext {
public static cross(u: Vector2, v: Vector2){
return u.y * v.x - u.x * v.y;
}
/**
* 返回与传入向量垂直的向量
* @param first
* @param second
*/
public static perpendicular(first: Vector2, second: Vector2){
return new Vector2(-1 * (second.y - first.y), second.x - first.x);
}
}