Просмотр исходного кода

use onViewMatrixChangedObservable

Trevor Baron 6 лет назад
Родитель
Сommit
12de26bdb1
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      src/Cameras/VR/vrExperienceHelper.ts

+ 4 - 4
src/Cameras/VR/vrExperienceHelper.ts

@@ -975,9 +975,9 @@ export class VRExperienceHelper {
         // If WebVR is supported and a headset is connected
         // If WebVR is supported and a headset is connected
         if (this._webVRready) {
         if (this._webVRready) {
             if (!this._webVRpresenting) {
             if (!this._webVRpresenting) {
-                this._scene.getEngine().onVRRequestPresentComplete.addOnce((result)=>{
+                this._scene.getEngine().onVRRequestPresentComplete.addOnce((result) => {
                     this.onAfterEnteringVRObservable.notifyObservers({success: result});
                     this.onAfterEnteringVRObservable.notifyObservers({success: result});
-                })
+                });
                 this._webVRCamera.position = this._position;
                 this._webVRCamera.position = this._position;
                 this._scene.activeCamera = this._webVRCamera;
                 this._scene.activeCamera = this._webVRCamera;
             }
             }
@@ -990,9 +990,9 @@ export class VRExperienceHelper {
             this._scene.activeCamera = this._vrDeviceOrientationCamera;
             this._scene.activeCamera = this._vrDeviceOrientationCamera;
             this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen);
             this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen);
             this.updateButtonVisibility();
             this.updateButtonVisibility();
-            this._scene.onAfterRenderObservable.addOnce(()=>{
+            this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce(() => {
                 this.onAfterEnteringVRObservable.notifyObservers({success: true});
                 this.onAfterEnteringVRObservable.notifyObservers({success: true});
-            })
+            });
         }
         }
 
 
         if (this._scene.activeCamera && this._canvas) {
         if (this._scene.activeCamera && this._canvas) {