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

setScale on matter bodies is resetting fixedRotation #6369

Closed
sushovande opened this issue Jan 28, 2023 · 1 comment
Closed

setScale on matter bodies is resetting fixedRotation #6369

sushovande opened this issue Jan 28, 2023 · 1 comment

Comments

@sushovande
Copy link

calling Phaser.Physics.Matter.Sprite.setScale(...) also resets the rotational inertia

Version

  • Phaser Version: Phaser v3.60.0-beta.18
  • Operating system: Windows 10
  • Browser: N/A, tested on chrome and firefox

Description

calling Phaser.Physics.Matter.Sprite.setScale(...) also resets the rotational inertia
When setting up matter bodies, we have to first set scale and then call setFixedRotation, otherwise setFixedRotation has no effect

Example Test Code

To demonstrate, open this example: https://labs.phaser.io/edit.html?src=src/physics/matterjs/fixed%20rotation.js
and add this to line 34: block.setFixedRotation(); block.setScale(0.7); Notice how the box rotates
if you instead switch the sequence block.setScale(0.7); block.setFixedRotation(); Notice how the box does not rotate as expected

@phaserjs phaserjs deleted a comment from SlimHajRomdhane Mar 26, 2023
@phaserjs phaserjs deleted a comment from likeavenus Jan 25, 2024
@phaserjs phaserjs deleted a comment from mohsen159 Jan 25, 2024
@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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants