|
|
Here's the expression I use - apply to a 3D layer's scale value, assuming your camera is called "Camera 1"
campos=thisComp.layer("Camera 1").toWorld([0,0,0]); // camera position //
zoom=thisComp.layer("Camera 1").cameraOption.zoom; // camera zoom //
lpos=thisLayer.toWorld(thisLayer.anchorPoint); // layer position //
lscl=thisLayer.transform.scale; // layer scale //
d=length(campos,lpos); // distance from layer to camera //
xscl=lscl[0];yscl=lscl[1];zscl=lscl[2];
x=(d/zoom)*xscl;
y=(d/zoom)*yscl;
z=(d/zoom)*zscl;
[x,y,z]
Basically, the camera's lens is measured in pixels and called "zoom". A layer will appear 100% of it's size (i.e. normal) when its distance from the camera is the same as the "zoom" value.
That expression calculates the distance in world space, so not affected by parenting, and takes into account the scale values already applied to the layer.
-Chris
-----Original Message-----
From: Rachel Max [mailto:rachelmax@mac.com]
Sent: Friday, January 24, 2014 10:16 AM
To: 'After Effects Mail List'
Subject: [AE] distribute layers in Z space - but keep "relative" positions
Hi again, in the vein of the anamorphic illusions - is there a script or trick to affect the Z of a layer, but have it appear as if it hasn’t moved by scaling it and changing it’s position?
I’ve been eyeballing it but that has to be an easier way or some math I can do.
Thanks,
Rachel
|
|