Przeglądaj źródła

fixed small issues with mesh and initial skin matrix

David Catuhe 8 lat temu
rodzic
commit
1f79f920f1
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      src/Bones/babylon.skeleton.ts

+ 6 - 1
src/Bones/babylon.skeleton.ts

@@ -10,6 +10,7 @@
         private _meshesWithPoseMatrix = new Array<AbstractMesh>();
         private _animatables: IAnimatable[];
         private _identity = Matrix.Identity();
+        private _synchronizedWithMesh: AbstractMesh;
 
         private _ranges: { [name: string]: AnimationRange; } = {};
 
@@ -240,7 +241,11 @@
 
                     if (!mesh._bonesTransformMatrices || mesh._bonesTransformMatrices.length !== 16 * (this.bones.length + 1)) {
                         mesh._bonesTransformMatrices = new Float32Array(16 * (this.bones.length + 1));
-                    
+                    }
+
+                    if (this._synchronizedWithMesh !== mesh) {
+                        this._synchronizedWithMesh = mesh;
+
                         // Prepare bones
                         for (var boneIndex = 0; boneIndex < this.bones.length; boneIndex++) {
                             var bone = this.bones[boneIndex];