Browse Source

Merge pull request #1921 from RaananW/webvr-small-fix

Projection matrix - correctly calculated.
David Catuhe 8 năm trước cách đây
mục cha
commit
de5f038e1d
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      src/Cameras/VR/babylon.webVRCamera.ts

+ 4 - 3
src/Cameras/VR/babylon.webVRCamera.ts

@@ -281,13 +281,14 @@ module BABYLON {
 
         protected _getWebVRProjectionMatrix(): Matrix {
             var projectionArray = this._cameraRigParams["left"] ? this._cameraRigParams["frameData"].leftProjectionMatrix : this._cameraRigParams["frameData"].rightProjectionMatrix;
+            Matrix.FromArrayToRef(projectionArray, 0, this._projectionMatrix);
+
             //babylon compatible matrix
             if (!this.getScene().useRightHandedSystem) {
-                [8, 9, 10, 11].forEach(function (num) {
-                    projectionArray[num] *= -1;
+                [8, 9, 10, 11].forEach((num) => {
+                    this._projectionMatrix.m[num] *= -1;
                 });
             }
-            Matrix.FromArrayToRef(projectionArray, 0, this._projectionMatrix);
             return this._projectionMatrix;
         }