Help adjusting an expression for 3D layers (2d layer expression works fine)
Hello,
I’m trying to create a column of 3d layers.
Layer 1 is the reference.
Then each new layer below Layer 1 should be N pixels down on the Y axis. Regardless of the size or shape of the layer above it.
I’ve been using this expression successfully, but fails when the layers are 3D:
l = thisComp.layer(index-1);
l.toComp([l.sourceRectAtTime(time).left + l.sourceRectAtTime(time).width/2, l.sourceRectAtTime(time).top + l.sourceRectAtTime(time).height])+[[0],[1]+thisComp.layer("Control").effect("Spacing")("Slider")]
So I’ve been trying to update it, so it has the exact same function but works for 3D layers. I came up with this;
a = thisComp.layer(index - 1).sourceRectAtTime();
s = thisComp.layer("Control").effect("Spacing")("Slider");
x = a.width / 2;
y = a.top + a.height + s;
z = thisComp.layer(index - 1).position[2];
toComp([x, y, z]);
Two failures come out of this.
1. The first layer works as intended but then every other layer doesn’t offset, and they just pile in on the same position.
2. Instead of aligning with the layer above, the position changes on the X and Z axis and I’m not sure why. For example it’s a 1920x1080 composition. After applying this expression, instead of being position z=0, it comes out z=2665.7
Any thoughts to simply make the first expression with 3D layers would be a massive help.
Thank you

