From 3f2e63fc17eced86977a92aabfc555e5f2f94642 Mon Sep 17 00:00:00 2001 From: Sean Bohan Date: Thu, 1 Mar 2018 09:02:04 +0800 Subject: [PATCH] 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. --- src/physics/arcade/Body.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/arcade/Body.js b/src/physics/arcade/Body.js index 31ee22a39..3398c5a35 100644 --- a/src/physics/arcade/Body.js +++ b/src/physics/arcade/Body.js @@ -788,8 +788,8 @@ var Body = new Class({ var sprite = this.gameObject; - this.position.x = sprite.x - sprite.displayOriginX + (sprite.scaleX * this.offset.x); - this.position.y = sprite.y - sprite.displayOriginY + (sprite.scaleY * this.offset.y); + this.position.x = sprite.x + sprite.scaleX * (this.offset.x - sprite.displayOriginX); + this.position.y = sprite.y + sprite.scaleY * (this.offset.y - sprite.displayOriginY); this.updateCenter();