setOrigin doesn't affect on physics center

Hi,

When I try to change the origin of a sprite, I found the bounds of this sprite didn’t transform according to the sprite origin.

// my physics engine config
physics: {
        default: 'arcade',
        arcade: {
          debug: true,
          gravity: { y: 100 }
        }
}

// in game scene, I created a physic game object
this.bottom = this.physics.add.staticImage(0, this.height, 'rect');
this.bottom.setOrigin(0, 1);
this.bottom.displayWidth = this.width;
this.bottom.displayHeight = 140;

The following is the render result, you can see the bounds doesn’t transform according to your setting origin.

Is it the correct result? I hope the physics bounds can be transformed according to the settings.
Are there any other better ways to do this?

Thanks,
Atom

Static bodies don’t update themselves when the sprite changes. You need

this.bottom.refreshBody();
2 Likes

Thanks samme, it works.