In AS3, I have a Sprite that has a Z axis rotation applied.
How do I calculate that Sprite's dimensions (it's original size) from Sprite.rotationZ and Sprite.getRect(...)?
In AS3, I have a Sprite that has a Z axis rotation applied.
How do I calculate that Sprite's dimensions (it's original size) from Sprite.rotationZ and Sprite.getRect(...)?
sprite.width
and sprite.height
on sprite.rotationZ = 0
would give you the original size.
antpaw's answer is best / easiest. It can also be done without ever seeing it visually if you switch the rotationZ back once you get your width and height, like so
var rotZ:Number = mySprite.rotationZ;
mySprite.rotationZ = 0;
var w:Number = mySprite.width;
var h:Number = mySprite.height;
mySprite.rotationZ = rotZ;
To do this mathematically you could look at this SO post and do the reverse.