Skip to content

Commit a556dfd

Browse files
Issue phaserjs#1885: P2.enableBody now checks if an anchor exists on target object before attempting to set its value
1 parent 8919e4e commit a556dfd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/physics/p2/World.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,9 @@ Phaser.Physics.P2.prototype = {
337337
{
338338
object.body = new Phaser.Physics.P2.Body(this.game, object, object.x, object.y, 1);
339339
object.body.debug = debug;
340-
object.anchor.set(0.5);
340+
if (typeof object.anchor !== 'undefined') {
341+
object.anchor.set(0.5);
342+
}
341343
}
342344

343345
},

0 commit comments

Comments
 (0)