Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Align multiple 3D layers on X and Y only

  • Align multiple 3D layers on X and Y only

    Posted by Noel Powell on February 4, 2022 at 2:20 pm

    I’ve searched all over but haven’t found a solution for this…

    I have two 3D layers with different dimensions, different Scale, and different Z-depths. Layer A is far in the distance, and Layer B is right in front of the camera. I need B’s anchor point to stick to A’s anchor point, no matter where layer A is positioned, without changing B’s Z-position. In other words, I need their X and Y comp coordinates to match.

    Any help you can give me is much appreciated.

    Noel Powell replied 4 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 4, 2022 at 7:46 pm

    Maybe:

    p = thisComp.layer("Layer A").position;

    c = thisComp.activeCamera.position;

    v = normalize(p - c);

    c + v*((value[2]-c[2])/v[2])

  • Noel Powell

    February 4, 2022 at 9:31 pm

    Thanks, Dan. I couldn’t get it to work the way I wanted. But I realized I hadn’t thought this all the way through. I wasn’t factoring in a moving camera and how the position of layers would need to shift to stay aligned as the camera moved. Since I can’t have them shifting like that, I’ll need to figure out another solution. Thanks for the taking the time – I hope the expression can help someone else out.

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