Browse Source

Moving rotation update to the right location

Raanan Weber 9 năm trước cách đây
mục cha
commit
da6b1674ba
2 tập tin đã thay đổi với 10 bổ sung9 xóa
  1. 10 0
      src/Mesh/babylon.abstractMesh.ts
  2. 0 9
      src/Mesh/babylon.mesh.ts

+ 10 - 0
src/Mesh/babylon.abstractMesh.ts

@@ -528,6 +528,16 @@
             Matrix.ScalingToRef(this.scaling.x * this.scalingDeterminant, this.scaling.y * this.scalingDeterminant, this.scaling.z * this.scalingDeterminant, Tmp.Matrix[1]);
 
             // Rotation
+            
+            //rotate, if quaternion is set and rotation was used
+            if (this.rotationQuaternion) {
+                var len = this.rotation.length();
+                if (len) {
+                    this.rotationQuaternion.multiplyInPlace(BABYLON.Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z))
+                    this.rotation.copyFromFloats(0, 0, 0);
+                }
+            }
+            
             if (this.rotationQuaternion) {
                 this.rotationQuaternion.toRotationMatrix(Tmp.Matrix[0]);
                 this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);

+ 0 - 9
src/Mesh/babylon.mesh.ts

@@ -721,15 +721,6 @@
             if (!this._geometry || !this._geometry.getVertexBuffers() || !this._geometry.getIndexBuffer()) {
                 return;
             }
-            
-            //rotate, if quaternion is set and rotation was used
-            if (this.rotationQuaternion) {
-                var len = this.rotation.length();
-                if (len) {
-                    this.rotationQuaternion.multiplyInPlace(BABYLON.Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z))
-                    this.rotation.copyFromFloats(0, 0, 0);
-                }
-            }
 
             var callbackIndex: number;
             for (callbackIndex = 0; callbackIndex < this._onBeforeRenderCallbacks.length; callbackIndex++) {