Browse Source

quaternion inspection

Making sure quaternion already exists before initializing it. If it
doesn't the user will continue using the normal rotation object instead.
Raanan Weber 10 năm trước cách đây
mục cha
commit
64d167a824
2 tập tin đã thay đổi với 9 bổ sung4 xóa
  1. 5 3
      src/Mesh/babylon.mesh.js
  2. 4 1
      src/Mesh/babylon.mesh.ts

+ 5 - 3
src/Mesh/babylon.mesh.js

@@ -795,7 +795,10 @@ var BABYLON;
             this.scaling.copyFromFloats(1, 1, 1);
             this.position.copyFromFloats(0, 0, 0);
             this.rotation.copyFromFloats(0, 0, 0);
-            this.rotationQuaternion = BABYLON.Quaternion.Identity();
+            //only if quaternion is already set
+            if(this.rotationQuaternion) {
+                this.rotationQuaternion = BABYLON.Quaternion.Identity();
+            }
             this._worldMatrix = BABYLON.Matrix.Identity();
         };
         // Cache
@@ -1725,5 +1728,4 @@ var BABYLON;
         return Mesh;
     })(BABYLON.AbstractMesh);
     BABYLON.Mesh = Mesh;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.mesh.js.map
+})(BABYLON || (BABYLON = {}));

+ 4 - 1
src/Mesh/babylon.mesh.ts

@@ -921,7 +921,10 @@
             this.scaling.copyFromFloats(1, 1, 1);
             this.position.copyFromFloats(0, 0, 0);
             this.rotation.copyFromFloats(0, 0, 0);
-            this.rotationQuaternion = Quaternion.Identity();
+            //only if quaternion is already set
+            if(this.rotationQuaternion) {
+                this.rotationQuaternion = Quaternion.Identity();
+            }
             this._worldMatrix = Matrix.Identity();
         }