The Matter SetBody Component will no longer try to call setOrigin unless the Game Object has the origin component (which not all do, like Graphics and Container)

This commit is contained in:
Richard Davey 2018-04-11 13:47:22 +01:00
parent 30d73a0197
commit 011e67d0f0
2 changed files with 5 additions and 1 deletions

View file

@ -75,6 +75,7 @@
* Calling `setOffset` on a Static Arcade Physics Body would break because the method was missing. It has been added and now functions as expected. Fix #3465 (thanks @josephjaniga and @DouglasLapsley)
* Calling Impact.World.remove(body) during a Body.updateCallback would cause the internal loop to crash when trying to access a now missing body. Two extra checks are in place to avoid this (thanks @iamDecode)
* If `setInteractive` is called on a Game Object that fails to set a hit area, it will no longer try to assign `dropZone` to an undefined `input` property.
* The Matter SetBody Component will no longer try to call `setOrigin` unless the Game Object has the origin component (which not all do, like Graphics and Container)
### Updates

View file

@ -125,7 +125,10 @@ var SetBody = {
this.world.add(this.body);
}
this.setOrigin(body.render.sprite.xOffset, body.render.sprite.yOffset);
if (this._originComponent)
{
this.setOrigin(body.render.sprite.xOffset, body.render.sprite.yOffset);
}
return this;
},