Jump to content

Weird transforms


Recommended Posts

I have a completed project that works on almost all devices. Yeah!


Except for Samsung Galaxy S3/Mini 4.1.2.  So far it's specifically that version of firmware.


On this device (and everything else) MOST of the time the game looks like this...



but SOMETIMES it looks like this...



Obviously something is going wrong in the context's transform. And it might happen anywhere in the game but it's always the rotation that's broken. Scaling and translation are always fine.


To be clear

* I never touch any transforms myself but I do some rotation and scaling of the book (which is the root sprite) by setting the .angle and .scale fields.

* I attach sprites to each other using addChild. 

* not everything is wrong in the same way (have the same bad rotation). You can see in the image different elements have a different bad rotation ie the text is more rotated that it's button.

* The buttons look weird because they're made of 3 separate images, left bit, middle bit, right bit.

* Once a sprite is created with a bad rotation it stays that way until it's destroyed.

* The sprites don't change their rotation over time. They stay as you see in the image.


One observation I've made is it SEEMS to be the deeper the sprite tree goes the worse the rotation error gets. So as an example the button graphic is attached to the paper and the button text is attached to the button graphic. The paper is rotated say 30 degrees, the button graphic is rotated 45 and the button text is rotated 60. This might suggest the same erroneous transform is being applied each time the renderer descends to a child.


Any clues or ANYTHING please suggest away cos I've got no idea.


Link to comment
Share on other sites

Yeah I suspected as much. For whatever reason the tween isn't reaching the end values, so the whole game remains rotated. You could try 'listening' for the tween to complete and then set the rotation to what it needs to be regardless of where it actually got to.

Link to comment
Share on other sites

Because the transform propagates down the entire display list, from stage on. If it doesn't have a chance to reset or reach its intended value then the context will be stuck in that transform and carry on getting worse and worse the further down it goes.

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...