소스 검색

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;
     }