开发者

Finding an original rectangle's dimensions from rotation and bounding box dimensions

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜