ソースを参照

avoid parent shape when using no imposotor

Trevor Baron 6 年 前
コミット
dfe6f9045b
1 ファイル変更9 行追加8 行削除
  1. 9 8
      src/Physics/Plugins/babylon.ammoJSPlugin.ts

+ 9 - 8
src/Physics/Plugins/babylon.ammoJSPlugin.ts

@@ -404,15 +404,16 @@ module BABYLON {
 
                 if (childrenAdded > 0) {
                     // Add parents shape as a child if present
-                    var shape = this._createShape(impostor, true);
-                    if (shape) {
-                        this._tmpAmmoTransform.getOrigin().setValue(0, 0, 0);
-                        this._tmpAmmoQuaternion.setValue(0, 0, 0, 1);
-                        this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion);
-
-                        returnValue.addChildShape(this._tmpAmmoTransform, shape);
+                    if (impostor.type != PhysicsImpostor.NoImpostor) {
+                        var shape = this._createShape(impostor, true);
+                        if (shape) {
+                            this._tmpAmmoTransform.getOrigin().setValue(0, 0, 0);
+                            this._tmpAmmoQuaternion.setValue(0, 0, 0, 1);
+                            this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion);
+
+                            returnValue.addChildShape(this._tmpAmmoTransform, shape);
+                        }
                     }
-
                     return returnValue;
                 }else {
                     // If no children with impostors create the actual shape below instead