瀏覽代碼

fix bug in PhysicsImpostor.HeightmapImpostor

Julien Barrois 6 年之前
父節點
當前提交
05b0f1fed0
共有 1 個文件被更改,包括 7 次插入1 次删除
  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);