Skip to content

Commit 1a493ca

Browse files
authored
Merge pull request phaserjs#4970 from samme/fix/arcade-body-setSize-center
Fix centering in Body#setSize()
2 parents d6b0341 + bc39e70 commit 1a493ca

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/physics/arcade/Body.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,10 +1236,10 @@ var Body = new Class({
12361236

12371237
if (center && gameObject.getCenter)
12381238
{
1239-
var ox = gameObject.displayWidth / 2;
1240-
var oy = gameObject.displayHeight / 2;
1239+
var ox = (gameObject.width - width) / 2;
1240+
var oy = (gameObject.height - height) / 2;
12411241

1242-
this.offset.set(ox - this.halfWidth, oy - this.halfHeight);
1242+
this.offset.set(ox, oy);
12431243
}
12441244

12451245
this.isCircle = false;

0 commit comments

Comments
 (0)