The P2 World wouldn't clear down fully on a State change, now properly clears out contacts, resets the bitmask, etc.

This commit is contained in:
photonstorm 2014-03-17 18:57:34 +00:00
parent 67919af33c
commit 96296c6582
2 changed files with 13 additions and 1 deletions

View file

@ -65,6 +65,7 @@ Bug Fixes
* Group enableBody parameter was incorrectly assigned to the debug var (thanks BurnedToast, fix #565)
* Fixed Tile callback check in Arcade Physics (fix #562)
* Removed the examples build script from the Gruntfile (fix #592)
* The P2 World wouldn't clear down fully on a State change, now properly clears out contacts, resets the bitmask, etc.
TODO:

View file

@ -659,6 +659,17 @@ Phaser.Physics.P2.prototype = {
this.world.clear();
this.world.off("beginContact", this.beginContactHandler, this);
this.world.off("endContact", this.endContactHandler, this);
this.collisionGroups = [];
this._toRemove = [];
this.boundsCollidesWith = [];
this._collisionGroupID = 2;
this.postBroadphaseCallback = null;
this.callbackContext = null;
this.impactCallback = null;
},
/**
@ -668,7 +679,7 @@ Phaser.Physics.P2.prototype = {
*/
destroy: function () {
this.world.clear();
this.clear();
this.game = null;