瀏覽代碼

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 年之前
父節點
當前提交
64d167a824
共有 2 個文件被更改,包括 9 次插入4 次删除
  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();
         }