Andrew V Butt Sr 5 년 전
부모
커밋
1a3fb7cc35
2개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      src/Bones/bone.ts
  2. 9 0
      src/Bones/skeleton.ts

+ 7 - 0
src/Bones/bone.ts

@@ -1140,4 +1140,11 @@ export class Bone extends Node {
 
         Vector3.TransformCoordinatesToRef(position, tmat, result);
     }
+
+    /**
+     * Set the current local matrix as the restPose for this bone.
+     */
+    public setCurrentPoseAsRest(): void {
+        this.setRestPose(this.getLocalMatrix());
+    }
 }

+ 9 - 0
src/Bones/skeleton.ts

@@ -880,4 +880,13 @@ export class Skeleton implements IAnimatable {
 
         bones.push(bone);
     }
+
+    /**
+     * Set the current local matrix as the restPose for all bones in the skeleton.
+     */
+    public setCurrentPoseAsRest(): void {
+        this.bones.forEach((b) => {
+            b.setCurrentPoseAsRest();
+        });
+    }
 }