Browse Source

(hopefully) Fix skeleton returnToRest (#8637)

* rest pose is really the matrix passed to the constructor

* handle case when the bones are not driven by transform nodes
Popov72 5 năm trước cách đây
mục cha
commit
efe0838bff
2 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 0 1
      loaders/src/glTF/2.0/glTFLoader.ts
  2. 5 1
      src/Bones/bone.ts

+ 0 - 1
loaders/src/glTF/2.0/glTFLoader.ts

@@ -1125,7 +1125,6 @@ export class GLTFLoader implements IGLTFLoader {
                 baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);
             }
 
-            babylonBone.setRestPose(baseMatrix);
             babylonBone.updateMatrix(baseMatrix, false, false);
             babylonBone._updateDifferenceMatrix(undefined, false);
         }

+ 5 - 1
src/Bones/bone.ts

@@ -223,7 +223,11 @@ export class Bone extends Node {
      * Sets the local matrix to rest pose matrix
      */
     public returnToRest(): void {
-        this.updateMatrix(this._restPose.clone(), false, false);
+        if (this._skeleton._numBonesWithLinkedTransformNode > 0) {
+            this.updateMatrix(this._restPose.clone(), false, false);
+        } else {
+            this.updateMatrix(this._restPose.clone());
+        }
     }
 
     /**