Pārlūkot izejas kodu

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

sebavan 5 gadi atpakaļ
vecāks
revīzija
8ea9dbeae6
3 mainītis faili ar 11 papildinājumiem un 1 dzēšanām
  1. 1 0
      dist/preview release/what's new.md
  2. 7 1
      src/Bones/bone.ts
  3. 3 0
      src/Debug/rayHelper.ts

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

@@ -34,6 +34,7 @@
 - Added an alternate option to the mesh edge renderer to generate edges faster / more accurately for unusual geometries (like the ones generated by CSG) ([Popov72](https://github.com/Popov72))
 - Added an option when creating the engine to switch matrix computation to 64 bits ([Popov72](https://github.com/Popov72))
 - Added support for the alpha component to the SSR post-process ([Popov72](https://github.com/Popov72))
+- Force compute world matrix of the newly-attached mesh of a ray helper ([RaananW](https://github.com/RaananW))
 
 ### Engine
 

+ 7 - 1
src/Bones/bone.ts

@@ -437,6 +437,8 @@ export class Bone extends Node {
                 } else {
                     tmat.copyFrom(this._parent.getAbsoluteTransform());
                 }
+            } else {
+                Matrix.IdentityToRef(tmat);
             }
 
             tmat.setTranslationFromFloats(0, 0, 0);
@@ -482,9 +484,11 @@ export class Bone extends Node {
                 } else {
                     tmat.copyFrom(this._parent.getAbsoluteTransform());
                 }
+                tmat.invert();
+            } else {
+                Matrix.IdentityToRef(tmat);
             }
 
-            tmat.invert();
             Vector3.TransformCoordinatesToRef(position, tmat, vec);
             lm.setTranslationFromFloats(vec.x, vec.y, vec.z);
         }
@@ -859,6 +863,8 @@ export class Bone extends Node {
             }
         }
 
+        this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform);
+
         var children = this.children;
         var len = children.length;
 

+ 3 - 0
src/Debug/rayHelper.ts

@@ -173,6 +173,9 @@ export class RayHelper {
             this._attachedToMesh.getScene().registerBeforeRender(this._updateToMeshFunction);
         }
 
+        // force world matrix computation before the first ray helper computation
+        this._attachedToMesh.computeWorldMatrix(true);
+
         this._updateToMesh();
     }