Selaa lähdekoodia

Merge pull request #1805 from abow/boneGetPositionFix

fix for bone.getPositionToRef in world space bug
David Catuhe 8 vuotta sitten
vanhempi
commit
6fd463d46f
1 muutettua tiedostoa jossa 8 lisäystä ja 1 poistoa
  1. 8 1
      src/Bones/babylon.bone.ts

+ 8 - 1
src/Bones/babylon.bone.ts

@@ -626,13 +626,20 @@ module BABYLON {
 
             }else{
                 
+                var wm;
+                
+                //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
+                if(mesh){
+                    wm = mesh.getWorldMatrix();
+                }
+                
                 this._skeleton.computeAbsoluteTransforms();
                 
                 var tmat = Tmp.Matrix[0];
 
                 if (mesh) {
                     tmat.copyFrom(this.getAbsoluteTransform());
-                    tmat.multiplyToRef(mesh.getWorldMatrix(), tmat);
+                    tmat.multiplyToRef(wm, tmat);
                 }else{
                     tmat = this.getAbsoluteTransform();
                 }