Skip to content

Commit 1a3b06a

Browse files
committed
The DisplayObject.worldRotation value didn't sign the wt.c value correctly, meaning the rotation would be wrong.
The `DisplayObject.worldScale` value didn't multiply the local objects scale into the calculation, meaning the value wasn't a true representation of the objects world scale.
1 parent 0880380 commit 1a3b06a

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
396396
* Sometimes the browser would cause a race condition where any connected Game Pads were being detected before the callback had a chance to be established. Also sometimes the rawPad references would become stale, and are now checked constantly (thanks @cwleonard #2471)
397397
* Sound.isPlaying was set to false when doing an audio loop, but never set back to true if it's a sound not using a marker (thanks @TheJasonReynolds #2529)
398398
* Phaser.Rectangle.aabb would fail if the Rectangles used negative offsets. It now calculates the bounds accurately (thanks @fillmoreb #2545)
399+
* The `DisplayObject.worldRotation` value didn't sign the `wt.c` value correctly, meaning the rotation would be wrong.
400+
* The `DisplayObject.worldScale` value didn't multiply the local objects scale into the calculation, meaning the value wasn't a true representation of the objects world scale.
399401

400402
### Pixi Updates
401403

src/pixi/display/DisplayObject.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,11 @@ PIXI.DisplayObject.prototype.updateTransform = function(parent)
474474
wt.ty = tx * pt.b + ty * pt.d + pt.ty;
475475
}
476476

477-
// multiply the alphas..
477+
// Set the World values
478478
this.worldAlpha = this.alpha * p.worldAlpha;
479-
480479
this.worldPosition.set(wt.tx, wt.ty);
481-
this.worldScale.set(Math.sqrt(wt.a * wt.a + wt.b * wt.b), Math.sqrt(wt.c * wt.c + wt.d * wt.d));
482-
this.worldRotation = Math.atan2(wt.c, wt.d);
480+
this.worldScale.set(this.scale.x * Math.sqrt(wt.a * wt.a + wt.c * wt.c), this.scale.y * Math.sqrt(wt.b * wt.b + wt.d * wt.d));
481+
this.worldRotation = Math.atan2(-wt.c, wt.d);
483482

484483
// reset the bounds each time this is called!
485484
this._currentBounds = null;

0 commit comments

Comments
 (0)