Merge pull request #925 from jonkelling/dev

Fix for issue #917, Physics.P2.Body#addToWorld
This commit is contained in:
Richard Davey 2014-07-01 15:52:29 +01:00
commit a425470f41

View file

@ -720,6 +720,17 @@ Phaser.Physics.P2.Body.prototype = {
*/
addToWorld: function () {
if (this.game.physics.p2._toRemove)
{
for (var i = 0; i < this.game.physics.p2._toRemove.length; i++)
{
if (this.game.physics.p2._toRemove[i] === this)
{
this.game.physics.p2._toRemove.splice(i, 1);
}
}
}
if (this.data.world !== this.game.physics.p2.world)
{
this.game.physics.p2.addBody(this);