Browse Source

Merge pull request #4170 from bghgary/webvrcamera-fix

Fix global position of webVRCamera
David Catuhe 7 năm trước cách đây
mục cha
commit
26ae4b3701
1 tập tin đã thay đổi với 8 bổ sung0 xóa
  1. 8 0
      src/Cameras/VR/babylon.webVRCamera.ts

+ 8 - 0
src/Cameras/VR/babylon.webVRCamera.ts

@@ -602,6 +602,14 @@ module BABYLON {
             }
 
             parentCamera._worldToDevice.multiplyToRef(this._webvrViewMatrix, this._webvrViewMatrix);
+
+            // Compute global position
+            this._workingMatrix = this._workingMatrix || Matrix.Identity();
+            this._webvrViewMatrix.invertToRef(this._workingMatrix);
+            this._workingMatrix.multiplyToRef(parentCamera.getWorldMatrix(), this._workingMatrix);
+            this._workingMatrix.getTranslationToRef(this._globalPosition);
+            this._markSyncedWithParent();
+
             return this._webvrViewMatrix;
         }