Pārlūkot izejas kodu

fix TargetCamera rotation animation

orangesuzuki 7 gadi atpakaļ
vecāks
revīzija
636ab8e7a6
1 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 4 2
      src/Cameras/babylon.targetCamera.ts

+ 4 - 2
src/Cameras/babylon.targetCamera.ts

@@ -270,11 +270,11 @@ module BABYLON {
         protected _updateCameraRotationMatrix() {
             if (this.rotationQuaternion) {
                 this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix);
-                //update the up vector!
-                BABYLON.Vector3.TransformNormalToRef(this._defaultUpVector, this._cameraRotationMatrix, this.upVector);
             } else {
                 Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
             }
+            //update the up vector!
+            BABYLON.Vector3.TransformNormalToRef(this._defaultUpVector, this._cameraRotationMatrix, this.upVector);
         }
 
         public _getViewMatrix(): Matrix {
@@ -287,6 +287,8 @@ module BABYLON {
                 // Computing target and final matrix
                 this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
             } else {
+                //update the up vector!
+                BABYLON.Vector3.TransformNormalToRef(this._defaultUpVector, this._cameraRotationMatrix, this.upVector);
                 this._currentTarget.copyFrom(this._getLockedTargetPosition());
             }