Phaser.Physics.Arcade.Sprite with non-center origin - weird body behaviour

Hi! I have created Phaser.Physics.Arcade.Sprite with dynamic body attached and I’m struggling with its behaviour. On the figure nr.1 below, there is freshly instantiated sprite with body debug rectangle. You can see it works perfectly. After the instantiation I call this code in order to flip sprite:

sprite.setOrigin(1, 0.5);
sprite.flipX = true;

gloveBodyError
As you can see on figure nr.2, sprite flip works okay, but the position of the body is not updated at all. I thought that dynamic body reacts on parent’s sprite changes, so when I change anchor on the sprite and flip it, it should affect also the body and re-position properly, but as you can see, this is not the case.

Is this correct behaviour? If so, what is the proper way to adjust physics body after sprite origin change?
Thanks in advance!

the origin of the image is at (1,0.5) which is in the middle of the right hand side edge of the sprite. This will be the sprite’s pivot point when you .flipX it.

Set the origin to (0.5,0.5) or change the body of the sprite or use .setOffset(x,y) to match the intended hitbox location (not that you will need to set it again if you intend to flip the sprite later on)

Thanks for your answer! .setOffset(x,y) was solution for my problem. Still, I would expect.flipX to flip also body, but it is written in doc that it doesnt, so fair enough, I guess.

Thanks again for help!

From what I know .flipX only deals with the graphics of the sprite itself, as does .setScale(), but I guess there are reasons for the hitbox/body to be separate from the graphics.