Skip to content

Commit 3f2e63f

Browse files
committed
Fix arcade body does not align with scaled parent object.
When a game object scaled, arcade body still calculate its position based on its original size instead of scaled one.
1 parent 9a561ff commit 3f2e63f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/physics/arcade/Body.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,8 +788,8 @@ var Body = new Class({
788788

789789
var sprite = this.gameObject;
790790

791-
this.position.x = sprite.x - sprite.displayOriginX + (sprite.scaleX * this.offset.x);
792-
this.position.y = sprite.y - sprite.displayOriginY + (sprite.scaleY * this.offset.y);
791+
this.position.x = sprite.x + sprite.scaleX * (this.offset.x - sprite.displayOriginX);
792+
this.position.y = sprite.y + sprite.scaleY * (this.offset.y - sprite.displayOriginY);
793793

794794
this.updateCenter();
795795

0 commit comments

Comments
 (0)