Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects › Align/Orient Layer to Null

  • Align/Orient Layer to Null

    Posted by Rob Milus on June 10, 2014 at 8:59 am

    Hey hey,

    I’ve been duplicating a bunch of 3D layer cards, and I’m trying to come up with a simple way of aligning their Y-axis towards another layer/null object. Aligning all the layers to the camera will mess with the depth and perspective of the shot, so I’m trying to steal the ‘Auto-Orient to Camera’ but apply it to a null object’s position. I feel like I’m missing something obvious here, but it’d be great if someone here could help point me in the right direct […puns].

    Cheers!

    John Cuevas replied 12 years, 3 months ago 2 Members · 1 Reply
  • 1 Reply
  • John Cuevas

    June 11, 2014 at 3:12 am

    Use the expression comnmand lookAt(fromPoint, atPoint), you can find it under the vector math expressions. You apply it to the orientation property of your layer.

    A finished version of the expression will look like this: lookAt(transform.position, thisComp.layer("Shape Layer 1").transform.position)

    In that expression, the “fromPoint” you use the layers own position “transform.position”. The atPoint, I just picked whipped to the position of the layer I want my lookie to orient.

    Now using that will orient all the directions, X,Y,Z. If you just want to move on the Y axis, you would want to add this expression to orientation.

    x = transform.orientation[0];
    y = lookAt(transform.position, thisComp.layer("Shape Layer 1").transform.position)[1];
    z= transform.orientation[2];

    [x,y,z]
    Here’s a sample project with both expressions. 7602_lookat.aep.zip

    Johnny Cuevas, Editor
    Thinkck.com

    “I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work.”
    —THOMAS EDISON on inventing the light bulb.

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