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

**URL:** <https://phaser.discourse.group/t/phaser-physics-arcade-sprite-with-non-center-origin-weird-body-behaviour/3301>\
**Category:** Phaser 3\
**Created:** [July 31, 2019, 1:06pm UTC](https://phaser.discourse.group/t/phaser-physics-arcade-sprite-with-non-center-origin-weird-body-behaviour/3301 "2019-07-31T13:06:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![crabBoy](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/crabboy/32/480_2.png) [@crabBoy](https://phaser.discourse.group/u/crabBoy)\
**Post date:** [July 31, 2019, 1:06pm UTC](https://phaser.discourse.group/t/phaser-physics-arcade-sprite-with-non-center-origin-weird-body-behaviour/3301/1 "2019-07-31T13:06:06Z")

</div>

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](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/9/919c37bfbc9853d9f386ce404b7f30eb764c269d.png)  
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!

---

<div class="post-metadata">

**Author:** ![ThePandaJam](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thepandajam/32/1814_2.png) [@ThePandaJam](https://phaser.discourse.group/u/ThePandaJam)\
**Post date:** [July 31, 2019, 1:56pm UTC](https://phaser.discourse.group/t/phaser-physics-arcade-sprite-with-non-center-origin-weird-body-behaviour/3301/2 "2019-07-31T13:56:46Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![crabBoy](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/crabboy/32/480_2.png) [@crabBoy](https://phaser.discourse.group/u/crabBoy)\
**Post date:** [August 1, 2019, 8:42am UTC](https://phaser.discourse.group/t/phaser-physics-arcade-sprite-with-non-center-origin-weird-body-behaviour/3301/3 "2019-08-01T08:42:47Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![ThePandaJam](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thepandajam/32/1814_2.png) [@ThePandaJam](https://phaser.discourse.group/u/ThePandaJam)\
**Post date:** [August 2, 2019, 8:57am UTC](https://phaser.discourse.group/t/phaser-physics-arcade-sprite-with-non-center-origin-weird-body-behaviour/3301/4 "2019-08-02T08:57:07Z")

</div>

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.
