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 years ago
parent
commit
64d167a824
2 changed files with 9 additions and 4 deletions
  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.scaling.copyFromFloats(1, 1, 1);
             this.position.copyFromFloats(0, 0, 0);
             this.position.copyFromFloats(0, 0, 0);
             this.rotation.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();
             this._worldMatrix = BABYLON.Matrix.Identity();
         };
         };
         // Cache
         // Cache
@@ -1725,5 +1728,4 @@ var BABYLON;
         return Mesh;
         return Mesh;
     })(BABYLON.AbstractMesh);
     })(BABYLON.AbstractMesh);
     BABYLON.Mesh = Mesh;
     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.scaling.copyFromFloats(1, 1, 1);
             this.position.copyFromFloats(0, 0, 0);
             this.position.copyFromFloats(0, 0, 0);
             this.rotation.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();
             this._worldMatrix = Matrix.Identity();
         }
         }