Jelajahi Sumber

Update webVRController.ts

Model is disposed (since it is not needed anymore), but on reenter it is not loaded again (since it was disposed, but is not null).
Raanan Weber 6 tahun lalu
induk
melakukan
d93e576896
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 4 2
      src/Gamepads/Controllers/webVRController.ts

+ 4 - 2
src/Gamepads/Controllers/webVRController.ts

@@ -12,7 +12,7 @@ export abstract class WebVRController extends PoseEnabledController {
     /**
      * Internal, the default controller model for the controller
      */
-    protected _defaultModel: AbstractMesh;
+    protected _defaultModel: Nullable<AbstractMesh>;
 
     // Observables
     /**
@@ -64,7 +64,7 @@ export abstract class WebVRController extends PoseEnabledController {
     /**
      * The default controller model for the controller
      */
-    public get defaultModel(): AbstractMesh {
+    public get defaultModel(): Nullable<AbstractMesh> {
         return this._defaultModel;
     }
 
@@ -154,6 +154,8 @@ export abstract class WebVRController extends PoseEnabledController {
      */
     public dispose(): void {
         super.dispose();
+        
+        this._defaultModel = null;
 
         this.onTriggerStateChangedObservable.clear();
         this.onMainButtonStateChangedObservable.clear();