You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling body.destroy() on a P2 body will cause an error. The destroy function does not null the sprite's body variable and during the next sprite.postUpdate(); it will attempt to run body.postUpdate() which is where the error occurs.
You can manually set sprite.body = null; after calling the destroy function to avoid this, but it seems this should be handled by the destroy function. Here is an example on jsfiddle
destroy: function(){this.removeFromWorld();this.clearShapes();this._bodyCallbacks={};this._bodyCallbackContext={};this._groupCallbacks={};this._groupCallbackContext={};if(this.debugBody){this.debugBody.destroy();}this.debugBody=null;this.sprite.body=null;//THIS LINE COULD FIX THIS... this.sprite=null;},
I don't know for sure though... cant test this right now.
Calling body.destroy() on a P2 body will cause an error. The destroy function does not null the sprite's body variable and during the next sprite.postUpdate(); it will attempt to run body.postUpdate() which is where the error occurs.
You can manually set sprite.body = null; after calling the destroy function to avoid this, but it seems this should be handled by the destroy function. Here is an example on jsfiddle
http://jsfiddle.net/Rr4LB/1/
The text was updated successfully, but these errors were encountered: