Explorar o código

Merge pull request #4170 from bghgary/webvrcamera-fix

Fix global position of webVRCamera
David Catuhe %!s(int64=7) %!d(string=hai) anos
pai
achega
26ae4b3701
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  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;
         }