A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] rotationX rotationY glitch

Hybrid View

  1. #1
    Senior Member flamedude's Avatar
    Join Date
    Jun 2003
    Location
    Vancouver, BC
    Posts
    252

    resolved [RESOLVED] rotationX rotationY glitch

    Hey guys,

    I'm struggling with a glitch and I just can't work it out. I've reduced the problem back to its core and this is it;

    Create a square movieclip 400px wide and tall. Give it an instance name and then set its rotationX or rotationY to 0, so for instance; mysquare_mc.rotationY = 0.

    When I do this the movieclip now has a width and height of 401px. I gain an extra pixel. I've tried setting different things like projectionCenter and fieldOfView but they have no effect on this unexpected difference in size.

    Is there any reason for this? I'm hoping there is something simple that I have missed. I'm using flash cs5.

    Any help or advice would be great.

    Steven.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    The width and height are those of the bounding box. When you rotate it, the bounding box has to get a little bigger. In the case of a square, the width and height will vary from the square's actual dimensions to Math.sqrt(2)*width. that's because if you rotate the square 45 degrees, its diagonal will be horizontal (and vertical), and the diagonal's length is given by the pythagorean theorem L = Math.sqrt(w*w + h*h).

    It's not a glitch.

  3. #3
    Senior Member flamedude's Avatar
    Join Date
    Jun 2003
    Location
    Vancouver, BC
    Posts
    252
    Hmmm... ok I guess I will just have to force it somehow to revert to its original dimensions. It sure looks like a glitch to me, I dont see why anyone would want the dimensions of a movieclip to change just because the rotationY/X was incremented by an entire half turn, even assigning a rotationY value of 0 affects the size.

    Its certainly unexpected.

    Thanks for the advice.

  4. #4
    Senior Member flamedude's Avatar
    Join Date
    Jun 2003
    Location
    Vancouver, BC
    Posts
    252
    Just thought I'd add the solution to this issue;

    http://www.flashandmath.com/flashcs4/blursol/index.html

    Pretty simple fix, just scale down your symbol to be rotated and it looks pixel perfect;

    var xfactor:Number = bit.width/(bit.width+1);
    var yfactor:Number = bit.height/(bit.height+1);
    bit.scaleX=xfactor;
    bit.scaleY=yfactor;

    This adjusts for the mysterious extra pixel in the width and height.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center