ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Match a 2d comp null position with a 3d space comp null position.

FAQ   •   VIEW ALL
 Match a 2d comp null position with a 3d space comp null position. on May 24, 2011 at 9:15:37 am

Hi,
I'm stuck with this!
Firstly, let me thank you in advance.
Well, here is my problem. I've a null (Null-1) object into a 2d space composition (CompA).
This CompA is, as well, a 3d layer into a 3d world composition (CompB).
I wanna match the relative position of Null-1 with Null-2

`<a href="http://i1.creativecow.net/u/204103/kk.jpg"><img src="//i1.creativecow.net/u/204103/kk.jpg" border="0" /></a>`

** LayerA and LayerB are comps.

Thanks a lot!

 Re: Match a 2d comp null position with a 3d space comp null position.on May 24, 2011 at 2:59:28 pm

If I understood the setup correctly, then this expression should work applied to Null-2's position property:

``` l1 = comp("CompA").layer("Null-1"); l2 = thisComp.layer("CompA"); p = l1.toComp(l1.anchorPoint); l2.toComp(p); ```

Darby Edelen

 Re: Match a 2d comp null position with a 3d space comp null position.on May 24, 2011 at 3:22:04 pm

It works very perfectly!
Well, not at all, it does the movement perfectly, but in a wrong position. I'm trying to get the movement over the surface of layer "Comp2" inside the composition "Comp3". In that way, I can get the same movement in a 3d space than the "null object" in the 2d composition.

Thanks!

 Re: Match a 2d comp null position with a 3d space comp null position.on May 24, 2011 at 3:28:06 pm

l1 = comp("PTA").layer("Null 1");
l2 = thisComp.layer("PTA");
p = l1.toComp(l1.anchorPoint);
l2.toWorld(p);

With this change ("toWorld") it woks perfectly!!!

Thanks a lot man!!

 Re: Match a 2d comp null position with a 3d space comp null position.on May 24, 2011 at 6:50:59 pm

Apologies, I misunderstood and thought you wanted a 2D composition location in the main comp. Glad you managed to make it work though! :)

Darby Edelen