mardi 29 décembre 2015

AS3: Moving the registration point of a container rotated in 3D space

I have a simple function that takes a container sprite with one child object and moves the registration point to the bottom right corner, with the child seemingly staying in place. But if the container sprite has a rotationX, rotationY, or rotationZ, the child object appears to change position slightly when the function is called. How can I do this while making the child appear to not change position?

function BR(s:Sprite):void {
    var dO:DisplayObject = s.getChildAt(0);
    s.x += dO.x + dO.width;
    s.y += dO.y + dO.height;
    dO.x = -dO.width;
    dO.y = -dO.height;
}

Aucun commentaire:

Enregistrer un commentaire