Skip to content

Using the .scale setter on a Matter gameobject doesn't update the matter body size #7001

Closed
@Stever1388

Description

@Stever1388

Version

  • Phaser Version: 3.86.0
  • Operating system: Windows
  • Browser: Chrome

Description

Setting the scale property on a Matter gameobject doesn't adjust the size of the matter body object so the physics bounds are incorrect. Setting the scale via setScale/scaleX/scaleY works however.

Example Test Code

If you enable body debug in your Game Config with

physics: {
   default: 'matter',
   matter: {
      gravity: {
         y: 0
      },
      debug: true,
      debugBodyColor: 0xffffff
   }
}

then you should be able to see the issue with the following code:

this.matterObj = this.scene.matter.add.gameObject(...);
this.matterObj.scale = 10;

Additional Information

It's possible that scale isn't a valid property on Matter gameobjects - looking at the Transform component of Matter gameobjects doesn't seem to include a scale property. However, the game we updated from Phaser 3.55.2 was using this property, and it seemed to work (though I can't verify it anymore). If it's not a property, I feel like it should be added to be consistent with out objects that have a scale property (makes tweening easier for example).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions