소스 검색

Fixed Vector2.Transform to also use Translation info of the Matrix

nockawa 9 년 전
부모
커밋
051e8f7019
2개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 2
      src/Math/babylon.math.js
  2. 2 2
      src/Math/babylon.math.ts

+ 2 - 2
src/Math/babylon.math.js

@@ -483,8 +483,8 @@ var BABYLON;
             return new Vector2(x, y);
         };
         Vector2.Transform = function (vector, transformation) {
-            var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]);
-            var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]);
+            var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + transformation.m[12];
+            var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + transformation.m[13];
             return new Vector2(x, y);
         };
         Vector2.Distance = function (value1, value2) {

+ 2 - 2
src/Math/babylon.math.ts

@@ -605,8 +605,8 @@
         }
 
         public static Transform(vector: Vector2, transformation: Matrix): Vector2 {
-            var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]);
-            var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]);
+            var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + transformation.m[12];
+            var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + transformation.m[13];
 
             return new Vector2(x, y);
         }