mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 14:08:28 +00:00
Matter JS bodies now have a destroy method that removes them from the world.
This commit is contained in:
parent
c6f4a6ed43
commit
b81b268b29
1 changed files with 8 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue