diff --git a/v3/src/physics/arcade/Collider.js b/v3/src/physics/arcade/Collider.js index ec85d52b1..1f92bf840 100644 --- a/v3/src/physics/arcade/Collider.js +++ b/v3/src/physics/arcade/Collider.js @@ -10,6 +10,8 @@ var Collider = new Class({ { this.world = world; + this.active = true; + this.overlapOnly = overlapOnly; this.object1 = object1; @@ -30,6 +32,20 @@ var Collider = new Class({ this.callbackContext, this.overlapOnly ); + }, + + destroy: function () + { + this.world.removeCollider(this); + + this.world = null; + + this.object1 = null; + this.object2 = null; + + this.collideCallback = null; + this.processCallback = null; + this.callbackContext = null; } }); diff --git a/v3/src/physics/arcade/World.js b/v3/src/physics/arcade/World.js index 7e7e63ac1..20e303edc 100644 --- a/v3/src/physics/arcade/World.js +++ b/v3/src/physics/arcade/World.js @@ -249,6 +249,11 @@ var World = new Class({ return collider; }, + removeCollider: function (collider) + { + // TODO + }, + update: function (time, delta) { if (this.isPaused || this.bodies.size === 0) @@ -286,7 +291,12 @@ var World = new Class({ for (i = 0; i < this.colliders.length; i++) { - this.colliders[i].update(); + var collider = this.colliders[i]; + + if (collider.active) + { + collider.update(); + } } },