diff --git a/src/components/body/ammo-body.js b/src/components/body/ammo-body.js index 264cce1..2c0e733 100644 --- a/src/components/body/ammo-body.js +++ b/src/components/body/ammo-body.js @@ -364,24 +364,15 @@ let AmmoBody = { if (this.triMesh) Ammo.destroy(this.triMesh); if (this.localScaling) Ammo.destroy(this.localScaling); if (this.compoundShape) Ammo.destroy(this.compoundShape); + if (this.body) { + Ammo.destroy(this.body); + delete this.body; + } Ammo.destroy(this.rbInfo); Ammo.destroy(this.msTransform); Ammo.destroy(this.motionState); Ammo.destroy(this.localInertia); Ammo.destroy(this.rotation); - if (this.body) { - if (!this.data.emitCollisionEvents) { - // As per issue 47 / PR 48 there is a strange bug - // not yet understood, where destroying an Ammo body - // leads to subsequent issues reporting collision events. - // - // So if we are reporting collision events, preferable to - // tolerate a small memory leak, by not destroying the - // Ammo body, rather than missing collision events. - Ammo.destroy(this.body); - } - delete this.body; - } }, beforeStep: function() {