Matter JS bodies now have a destroy method that removes them from the world.

This commit is contained in:
Richard Davey 2018-02-14 19:33:56 +00:00
parent c6f4a6ed43
commit b81b268b29

View file

@ -112,6 +112,14 @@ var SetBody = {
this.body = body;
this.body.gameObject = this;
var _this = this;
this.body.destroy = function ()
{
_this.world.remove(_this.body);
_this.body.gameObject = null;
};
if (addToWorld)
{
this.world.add(this.body);