Skip to content

Commit 011e67d

Browse files
committed
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)
1 parent 30d73a0 commit 011e67d

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
* 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)
7676
* 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)
7777
* 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.
78+
* 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)
7879

7980
### Updates
8081

src/physics/matter-js/components/SetBody.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ var SetBody = {
125125
this.world.add(this.body);
126126
}
127127

128-
this.setOrigin(body.render.sprite.xOffset, body.render.sprite.yOffset);
128+
if (this._originComponent)
129+
{
130+
this.setOrigin(body.render.sprite.xOffset, body.render.sprite.yOffset);
131+
}
129132

130133
return this;
131134
},

0 commit comments

Comments
 (0)