Przeglądaj źródła

clear observable when camera is disposed

Trevor Baron 6 lat temu
rodzic
commit
8aa4cab54d

+ 5 - 0
src/Cameras/Inputs/freeCameraDeviceOrientationInput.ts

@@ -76,6 +76,11 @@ export class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera
         if (this._camera != null && !this._camera.rotationQuaternion) {
             this._camera.rotationQuaternion = new Quaternion();
         }
+        if (this._camera) {
+            this._camera.onDisposeObservable.add(() => {
+                this._onDeviceOrientationChangedObservable.clear();
+            });
+        }
     }
 
     /**