Selaa lähdekoodia

Merge pull request #5886 from TrevorDev/rigCameraOnActiveCameraChanged

onActiveCameraChanged shouldn't be fired when rendering rig cameras
David Catuhe 6 vuotta sitten
vanhempi
commit
2661675407
2 muutettua tiedostoa jossa 6 lisäystä ja 3 poistoa
  1. 1 0
      dist/preview release/what's new.md
  2. 5 3
      src/scene.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -112,6 +112,7 @@
 - Added setColor method to boundingBoxGizmo ([TrevorDev](https://github.com/TrevorDev))
 - Added OnAfterEnteringVRObservable to webVRHelper ([TrevorDev](https://github.com/TrevorDev))
 - Added Support for Side By Side and Top/Bottom VR videos in the [video dome](https://doc.babylonjs.com/how_to/360videodome#video-types) ([Sebavan](https://github.com/Sebavan))
+- onActiveCameraChanged shouldn't be fired when rendering rig cameras ([TrevorDev](https://github.com/TrevorDev))
 
 ### OBJ Loader
 - Add color vertex support (not part of standard) ([brianzinn](https://github.com/brianzinn))

+ 5 - 3
src/scene.ts

@@ -3995,7 +3995,8 @@ export class Scene extends AbstractScene implements IAnimatable {
 
         var engine = this._engine;
 
-        this.activeCamera = camera;
+        // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged
+        this._activeCamera = camera;
 
         if (!this.activeCamera) {
             throw new Error("Active camera not set");
@@ -4124,8 +4125,9 @@ export class Scene extends AbstractScene implements IAnimatable {
             this._renderForCamera(camera._rigCameras[index], camera);
         }
 
-        this.activeCamera = camera;
-        this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix());
+        // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged
+        this._activeCamera = camera;
+        this.setTransformMatrix(this._activeCamera.getViewMatrix(), this._activeCamera.getProjectionMatrix());
     }
 
     private _checkIntersections(): void {