Skip to content

Commit f9994fa

Browse files
committed
Fixed a bug in Arcade Physics Body.preUpdate which would incorrectly apply the position of an offset Body (one which has had Body.setSize used on it) when combined with a Sprite with a non-zero anchor (thanks @SBCGames phaserjs#2470)
1 parent 19dce62 commit f9994fa

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
356356

357357
* Fixed an issue in the Arcade Physics overlap method where it would only detect overlaps up to the max bias threshold and no further (thanks @rgk #2441)
358358
* InputHandler.checkPointerDown and checkPointerOver will now test the worldTransform scale property of a Sprite. If zero it will fast return, where-as before it would incorrectly report an up event (thanks @jaapaurelio #2466)
359-
*
359+
* Fixed a bug in Arcade Physics Body.preUpdate which would incorrectly apply the position of an offset Body (one which has had Body.setSize used on it) when combined with a Sprite with a non-zero anchor (thanks @SBCGames #2470)
360360

361361
### Pixi Updates
362362

src/physics/arcade/Body.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,9 @@ Phaser.Physics.Arcade.Body.prototype = {
444444

445445
this.updateBounds();
446446

447-
this.position.x = (this.sprite.world.x - (this.sprite.anchor.x * this.width)) + this.offset.x;
448-
this.position.y = (this.sprite.world.y - (this.sprite.anchor.y * this.height)) + this.offset.y;
447+
this.position.x = (this.sprite.world.x - (this.sprite.anchor.x * this.sprite.width)) + this.offset.x;
448+
this.position.y = (this.sprite.world.y - (this.sprite.anchor.y * this.sprite.height)) + this.offset.y;
449+
449450
this.rotation = this.sprite.angle;
450451

451452
this.preRotation = this.rotation;

0 commit comments

Comments
 (0)