I was beating my head against the wall trying to figure out why my sourcerectattime expression wasn't accurate and then I noticed that it doesn't take into account the 3D position. I found a forum post related to this with a possible solution from Dan, but the original post wasn't exactly my issue so I wanted to make sure there wasn't a simpler solution to getting the screen space of a 3D layer.Â
Dan's expression from the post I found.Â
---
Common to position and scale expressions:
L=thisComp.layer("3d layer");
R=L.sourceRectAtTime(time,false);
UL = L.toComp([R.left,R.top]);
UR = L.toComp([R.left+R.width,R.top]);
LR = L.toComp([R.left+R.width,R.top+R.height]);
LL = L.toComp([R.left,R.top+R.height]);
maxX = Math.max(UL[0],UR[0],LR[0],LL[0]);
minX = Math.min(UL[0],UR[0],LR[0],LL[0]);
maxY = Math.max(UL[1],UR[1],LR[1],LL[1]);
minY = Math.min(UL[1],UR[1],LR[1],LL[1]);
Add this for position:
[maxX+minX,maxY+minY]/2;
Add this for scale:
w = maxX - minX;
h = maxY - minY;
[(w/width),h/height]*100
Dan Â
---