浏览代码

Merge pull request #6987 from Poolminer/sub1

Vector2 normalization without multiplication
David Catuhe 5 年之前
父节点
当前提交
023958ea9f
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      src/Maths/math.vector.ts

+ 2 - 4
src/Maths/math.vector.ts

@@ -368,10 +368,8 @@ export class Vector2 {
             return this;
         }
 
-        var num = 1.0 / len;
-
-        this.x *= num;
-        this.y *= num;
+        this.x /= len;
+        this.y /= len;
 
         return this;
     }