Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Stever1388 opened this issue Jan 9, 2025 · 1 comment
Assignees

Comments

@Stever1388
Copy link

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).

@zekeatchan
Copy link
Collaborator

Hi @Stever1388. Thanks for submitting this issue. We have fixed this and pushed it to the master branch. It will be part of the next release. Do test it out and let us know if you encounter any issues.

@zekeatchan zekeatchan self-assigned this Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants