Преглед на файлове

Fix http://www.html5gamedevs.com/topic/40650-null-engine-behaviour-using-setpivotpoint-and-csg/?tab=comments#comment-232304

David Catuhe преди 6 години
родител
ревизия
1e37e3b9d1
променени са 2 файла, в които са добавени 13 реда и са изтрити 9 реда
  1. 6 2
      src/Mesh/babylon.mesh.ts
  2. 7 7
      src/Mesh/babylon.transformNode.ts

+ 6 - 2
src/Mesh/babylon.mesh.ts

@@ -216,7 +216,7 @@ module BABYLON {
         // Will be used to save a source mesh reference, If any
         private _source: Nullable<Mesh> = null;
         // Will be used to for fast cloned mesh lookup
-        private meshMap: Nullable<{[id: string]: Mesh | undefined}>;
+        private meshMap: Nullable<{ [id: string]: Mesh | undefined }>;
 
         /**
          * Gets the source mesh (the one used to clone this one from)
@@ -2471,7 +2471,11 @@ module BABYLON {
             }
 
             serializationObject.scaling = this.scaling.asArray();
-            serializationObject.localMatrix = this.getPivotMatrix().asArray();
+            if (this._postMultiplyPivotMatrix) {
+                serializationObject.pivotMatrix = this.getPivotMatrix().asArray();
+            } else {
+                serializationObject.localMatrix = this.getPivotMatrix().asArray();
+            }
 
             serializationObject.isEnabled = this.isEnabled(false);
             serializationObject.isVisible = this.isVisible;

+ 7 - 7
src/Mesh/babylon.transformNode.ts

@@ -89,7 +89,7 @@ module BABYLON {
         private _absolutePosition = Vector3.Zero();
         private _pivotMatrix = Matrix.Identity();
         private _pivotMatrixInverse: Matrix;
-        private _postMultiplyPivotMatrix = false;
+        protected _postMultiplyPivotMatrix = false;
 
         protected _isWorldMatrixFrozen = false;
 
@@ -120,7 +120,7 @@ module BABYLON {
         /**
           * Gets or set the node position (default is (0.0, 0.0, 0.0))
           */
-         public get position(): Vector3 {
+        public get position(): Vector3 {
             return this._position;
         }
 
@@ -269,11 +269,11 @@ module BABYLON {
             this._cache.billboardMode = -1;
         }
 
-         /**
-         * Flag the transform node as dirty (Forcing it to update everything)
-         * @param property if set to "rotation" the objects rotationQuaternion will be set to null
-         * @returns this transform node
-         */
+        /**
+        * Flag the transform node as dirty (Forcing it to update everything)
+        * @param property if set to "rotation" the objects rotationQuaternion will be set to null
+        * @returns this transform node
+        */
         public markAsDirty(property: string): TransformNode {
             if (property === "rotation") {
                 this.rotationQuaternion = null;