Browse Source

Merge pull request #8101 from Popov72/bones-attachtobone

AttachToBone: Make sure bone matrices are up to date before getting the world matrix
David Catuhe 5 years ago
parent
commit
36c52454af
2 changed files with 3 additions and 0 deletions
  1. 1 0
      dist/preview release/what's new.md
  2. 2 0
      src/Meshes/transformNode.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -168,6 +168,7 @@
 - Fix an error in applying texture to sides of `extrudePolygon` using faceUV[1] ([JohnK](https://github.com/BabylonJSGuide/))
 - Fix an error in applying texture to sides of `extrudePolygon` using faceUV[1] ([JohnK](https://github.com/BabylonJSGuide/))
 - Playground didn't work if query params were added to the URL ([RaananW](https://github.com/RaananW))
 - Playground didn't work if query params were added to the URL ([RaananW](https://github.com/RaananW))
 - Fixed Path3D `_distances` / length computation ([Poolminer](https://github.com/Poolminer))
 - Fixed Path3D `_distances` / length computation ([Poolminer](https://github.com/Poolminer))
+- Make sure bone matrices are up to date when calling `TransformNode.attachToBone` ([Popov72](https://github.com/Popov72))
 
 
 ## Breaking changes
 ## Breaking changes
 
 

+ 2 - 0
src/Meshes/transformNode.ts

@@ -798,6 +798,8 @@ export class TransformNode extends Node {
         this._transformToBoneReferal = affectedTransformNode;
         this._transformToBoneReferal = affectedTransformNode;
         this.parent = bone;
         this.parent = bone;
 
 
+        bone.getSkeleton().prepare();
+
         if (bone.getWorldMatrix().determinant() < 0) {
         if (bone.getWorldMatrix().determinant() < 0) {
             this.scalingDeterminant *= -1;
             this.scalingDeterminant *= -1;
         }
         }