Explorar o código

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 %!s(int64=10) %!d(string=hai) anos
pai
achega
64d167a824
Modificáronse 2 ficheiros con 9 adicións e 4 borrados
  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();
         }