ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Align/Orient Layer to Null

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
rob milus
Align/Orient Layer to Null
on Jun 10, 2014 at 8:59:36 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].


Return to posts index

John Cuevas
Re: Align/Orient Layer to Null
on Jun 11, 2014 at 3:12:47 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];


Here's a sample project with both expressions.

Johnny Cuevas, Editor

"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.

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 All Rights Reserved