Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Converting rotation orders – X>Y>Z to Y>X>Z

  • Converting rotation orders – X>Y>Z to Y>X>Z

    Posted by Jamie Bradshaw on April 8, 2011 at 5:25 pm

    This is a follow up to this thread…
    https://forums.creativecow.net/thread/227/17971
    … I thought I’d start a new one as I’ve managed to isolate the problem to a rotation order issue.

    Basically I am looking for a function that could convert the rotation order of X>Y>Z to Y>X>Z.

    I tried to workaround this be creating a parented structure to force a Y>X>Z order but unfortunately this caused massive problems with other parts of the composition.

    I have been struggling through this problem for ages and I am close to losing my mind. If anyone could help I would be so grateful, especially as I am beginning to get quite a bit of pressure from the client now.

    I guess I am looking for an expression that looks something like this:

    //
    camL = thisComp.layer(“Camera 1”);

    x1 = camL.xRotation;
    y1 = camL.yRotation;
    z1 = camL.zRotation;

    rot1 = [x1, y1, z1];

    convertXYZtoYXZ(rot1);

    function convertXYZtoYXZ(r1) {
    // clever maths code here
    return([pan, tilt, roll]);
    }
    //

    Many thanks,
    Jamie

    JimJam•Graphics
    https://www.jimjamgraphics.com/

    Daniel Crooks replied 15 years, 1 month ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    April 9, 2011 at 12:26 am

    It’s definitely possible, but I think it’s going to involve some pretty complex math. I think you’re going to need a rotation matrix to unroll the x,y,z rotation and then another to roll it in y,x,z order. Even if you’re familiar with matrix math, it’s probably going to take quite a bit of work to get it right.

    Dan

  • Jamie Bradshaw

    April 9, 2011 at 2:41 pm

    Cheers Dan.

    I suspected that it might be something along those lines. I’ve found this documentation:
    https://www.geometrictools.com/Documentation/EulerAngles.pdf

    …and I’m hoping I can work out what’s needed from there. Wish me luck!

    Jamie

    JimJam•Graphics
    https://www.jimjamgraphics.com/

  • Dan Ebberts

    April 9, 2011 at 4:48 pm

    That looks like a very nice resource. I think you just need to rotate -z,-y,-x,y,x,z. You need to make sure that the “handedness” of the rotation matrices matches AE, which I think is a right-handed coordinate system. The devil is in the details though. Please report back if you crack it or get stuck somewhere.

    Dan

  • Daniel Crooks

    April 9, 2011 at 11:16 pm

    hi Jamie

    I’d be very keen to hear if you crack the problem
    I’m struggling with something similar.
    I want to convert the orientation values of an AE camera back into traditional “pan & tilt” values.

    cheers../Daniel

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy