소스 검색

Merge pull request #4170 from bghgary/webvrcamera-fix

Fix global position of webVRCamera
David Catuhe 7 년 전
부모
커밋
26ae4b3701
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  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;
         }