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

scaleX then scaleY lead to matterjs shape error #4206

Closed
YannCaron opened this issue Dec 1, 2018 · 2 comments
Closed

scaleX then scaleY lead to matterjs shape error #4206

YannCaron opened this issue Dec 1, 2018 · 2 comments

Comments

@YannCaron
Copy link

YannCaron commented Dec 1, 2018

Version

  • Phaser Version: 3.15.1

  • Operating system: ubuntu

  • Browser: All

Description

When a Matter.Image, configured with a physic shape, is scaled on X then on Y or vice versa, the shape become distorted.
It seems that the second scale apply again the first one.

class Actor extends Phaser.Physics.Matter.Image {
    constructor(scene, x, y, texture) {
    super(scene.matter.world, x, y, texture, 0, {
        shape: scene.fixtures[texture]
    });

    // ....

}

let gem = new Actor(this, 100, 400, 'Gem Blue');
gem.scaleX = 0.5;
// here everything is ok
gem.scaleY = 0.5;
// here the shape x is resized again

give that (with debug mode activated) :

  • With scaleX = 0.5 then scaleY = 0.5
    image

  • With scaleY=0.5 then scaleX = 0.5
    image

turn around

Use setScale(0.5, 0.5) instead.

words

Many thanks to Phaser and matterjs teams that give us so valuable tools.
Cheers.

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

@YannCaron
Copy link
Author

Many thanks @photonstorm, I will try to compil it when I find a few time 🥇

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