Parcourir la source

fix bug in PhysicsImpostor.HeightmapImpostor

Julien Barrois il y a 6 ans
Parent
commit
05b0f1fed0
1 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 7 1
      src/Physics/Plugins/babylon.cannonJSPlugin.ts

+ 7 - 1
src/Physics/Plugins/babylon.cannonJSPlugin.ts

@@ -435,7 +435,13 @@ module BABYLON {
                 //get original center with no rotation
                 var c = center.clone();
 
-                var oldPivot = mesh.getPivotMatrix() || Matrix.Translation(0, 0, 0);
+                var oldPivot = mesh.getPivotMatrix();
+                if (oldPivot) {
+                    oldPivot = oldPivot.clone()
+                }
+                else {
+                     Matrix.Identity();
+                }
 
                 //calculate the new center using a pivot (since this.BJSCANNON.js doesn't center height maps)
                 var p = Matrix.Translation(boundingInfo.boundingBox.extendSizeWorld.x, 0, -boundingInfo.boundingBox.extendSizeWorld.z);