Copy link to clipboard
Copied
The Setup:
Comp 1 is 2000x3000 pixels. Comp 1 contains Layer X that is positioned at 1750,1250. (or whatever)
I pull Comp 1 into Comp 2 which is 800x600. I scale and move Comp 1 inside Comp 2 by an arbitrary amount.
How can I determine Layer X's position using Comp 2's coordinate space?
Something like this:
L1 = comp("Comp 1").layer("Layer X");
P1 = L1.toWorld(L1.anchorPoint);
L2 = thisComp.layer("Comp 1");
L2.toWorld(P1)
Dan
Copy link to clipboard
Copied
Something like this:
L1 = comp("Comp 1").layer("Layer X");
P1 = L1.toWorld(L1.anchorPoint);
L2 = thisComp.layer("Comp 1");
L2.toWorld(P1)
Dan
Copy link to clipboard
Copied
Perfect! Dan, you are indeed the man!
Copy link to clipboard
Copied
Hey Dan.
I'm having trouble using this with a null.
So Null A is in Comp XX. Comp XX is pulled into Comp ZZ and moved/scaled. When I put your expression into an effect's Point Control, it doesn't line up where the Null is supposed to be in Comp XX.
What am I missing?
Copy link to clipboard
Copied
Try changing the last line to this:
L2.toComp(P1)
Dan
Copy link to clipboard
Copied
Hmmmm... That's not working either.
Inserting this expression into an Effect's point control doesn't put it in the right position. I tried inserting this expression into another (2D) null's position, but it's in the same incorrect place.
Original Null A Position (from C4D project import). This comp is put into Comp ZZ.
Applying that Expression to Null's position in Comp ZZ puts the new Null B way off in the corner.
Copy link to clipboard
Copied
Hard to say without looking at it. What's the exact expression you're using? Also, are all layers and comps square pixels?
Dan
Copy link to clipboard
Copied
Ooookay. I think I got it. The generic comp names was mixing me up. I didn't understand that the L2 should refer to the same pre-comp as where the original null is. I was putting the name of the layer I was applying this expression to.
So yeah, this works when applied to Point Control of an effect and an objects position
L1 = comp("MyLogo").layer("FlareNull");
P1 = L1.toComp(L1.anchorPoint);
L2 = thisComp.layer("MyLogo");
L2.toWorld(P1)
What's the diff between toWorld and toComp? World = 3D and Comp= 2D?
Copy link to clipboard
Copied
Pretty much. toComp() is what you use to get the 2D position in the comp view.
Dan
Copy link to clipboard
Copied
See if this helps...
http://db.tt/7IBNIhu