# Sprite rotation does not turn off in Matter Physics

**URL:** <https://phaser.discourse.group/t/sprite-rotation-does-not-turn-off-in-matter-physics/13915>\
**Category:** Phaser 3\
**Created:** [January 22, 2024, 6:06pm UTC](https://phaser.discourse.group/t/sprite-rotation-does-not-turn-off-in-matter-physics/13915 "2024-01-22T18:06:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![likeavenus](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/likeavenus/32/7678_2.png) [@likeavenus](https://phaser.discourse.group/u/likeavenus)\
**Post date:** [January 22, 2024, 6:06pm UTC](https://phaser.discourse.group/t/sprite-rotation-does-not-turn-off-in-matter-physics/13915/1 "2024-01-22T18:06:47Z")

</div>

This code should create a sprite when moving too

```javascript
create() {
  this.lizard = this.matter.add.sprite(400, 2000, "lizard", undefined).setFixedRotation();
}

update() {
    const speed = 5;
    if (this.cursors.left.isDown) {
      this.lizard.setVelocityX(-speed);
    } else if (this.cursors.right.isDown) {
      this.lizard.setVelocityX(speed);
    } else {
      this.lizard.setVelocityX(0);
    }
}

const config: Phaser.Types.Core.GameConfig = {
  type: Phaser.WEBGL,
  width: window.innerWidth,
  height: window.innerHeight,
  scale: {
    mode: Phaser.Scale.FIT,
    autoCenter: Phaser.Scale.CENTER_BOTH,
  },
  physics: {
    default: "matter",
    matter: {
      debug: true,
      // gravity: {
      // y: 1,
      // },
    },
  },
  scene: [Preloader, Game],
  plugins: {
    scene: [
      {
        key: "rexUI",
        plugin: UIPlugin,
        mapping: "rexUI",
      },
    ],
  },
};

```

But when you move the sprite it flips  
Everywhere they write that setFixedRotation fixed the situation, they also write to set body.inertia = Infinity but this also does not help. What to do?

Phaser 3.70

---

<div class="post-metadata">

**Author:** ![likeavenus](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/likeavenus/32/7678_2.png) [@likeavenus](https://phaser.discourse.group/u/likeavenus)\
**Post date:** [January 22, 2024, 6:52pm UTC](https://phaser.discourse.group/t/sprite-rotation-does-not-turn-off-in-matter-physics/13915/2 "2024-01-22T18:52:18Z")

</div>

I found this [setScale on matter bodies is resetting fixedRotation · Issue #6369 · phaserjs/phaser · GitHub](https://github.com/phaserjs/phaser/issues/6369)  
using setScale also resets setFixedRotation  
this works:

```javascript
this.lizard = this.matter.add
      .sprite(400, 2000, "lizard", undefined)
      .setScale(3)
      .setFixedRotation();

```
