From: "Byron Nash" Received: from mail-qk0-f181.google.com ([209.85.220.181] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 6451124 for AE-List@media-motion.tv; Wed, 16 May 2018 13:58:11 +0200 Received: by mail-qk0-f181.google.com with SMTP id s83-v6so371661qke.7 for ; Wed, 16 May 2018 05:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=VTFbZfL9H6ijZ0jBshqmgEdy23GNrQbiXTxEDhzb9qM=; b=ArTzGFjR72swKc4LSNYh70z44OzZ3wWVJwp1vIZ+gc5OHSkGhNoxY/H50cbz3W3s0j 6TxVTJrUurCs98pPdlbp1+z2wr63qEpoMoryPbYAb14I1YkOkg2Fd7u5V3k+uJdPc5r+ 5xcfsEcRNONhKg5pvf9y3OuVzW8G2JT26G0W05VRTeL400eWVDsuRey7EN+WhU9wKvPz JQb/l6+r9z8Qjs/xS3IjWmNGRunhv5h4YSM81X/SFvjOKaH8if0Cve3vvH8kvpkWaP8r S09JDmvT9ScW6Z089Q9dsoi9KEpJeErQZQoLN3gii5O++bZKBzsmNTQAl6IN0XnSZwy+ 7N5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=VTFbZfL9H6ijZ0jBshqmgEdy23GNrQbiXTxEDhzb9qM=; b=Ppk20X87vGCWn+kga5kziL+fy7WVg4mdIRxKZcC5fww4byWZTcMUdnzNSrC2ZOoxMX TMzDVsNBIQp+DkgdhgyL9N98yaLKHeALaQc8lpefC01awVTdIb3kDK9UO+3lpi6pOPpZ Zo2Z46Z9YxVOPh02VzuOXW5wJmL9o3UdIsp/jPK05PaxhKu8MTJCL0ap1yz2ZwKuUhXI vYCGNuu5PXcfFxBPP4r7D7sRIB46AjYj44COFkVzCxPj2sahB1X+RluJh+YKlOSHVbbO +ZQOgf2yLCaTtAYuzmR2aIZXASyJ4aNsGQJik4d6ZOAgsNcmNyb00C/EZvtKs8jbaCZt AV3Q== X-Gm-Message-State: ALKqPwd2YlEJPX4g3fS4M5L4iAqphcOm77OCqHYRl2MBzgu8InSLYx63 LvejCB9wXD5WXhedJnH0KrT4WGjpMI4tRqN+ots= X-Google-Smtp-Source: AB8JxZqyBx0KZboVeTHj3V02rsuHcP4+qzTi2n9KsqfbX8OVV9PqVZlJwdDl2P9jo1Cn2/Y1n6mzYN0bsg2tJO9RzNg= X-Received: by 2002:a37:db11:: with SMTP id e17-v6mr489485qki.333.1526472281314; Wed, 16 May 2018 05:04:41 -0700 (PDT) MIME-Version: 1.0 Date: Wed, 16 May 2018 08:04:30 -0400 Message-ID: Subject: SourceRectAtTime on 3D layers To: After Effects Mail List Content-Type: multipart/alternative; boundary="000000000000165907056c5186bb" --000000000000165907056c5186bb Content-Type: text/plain; charset="UTF-8" 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 --- --000000000000165907056c5186bb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I was beating my head against the wall trying to figure ou= t 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 pos= t 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 sim= pler solution to getting the screen space of a 3D layer.=C2=A0

Dan's expression from the post I found.=C2=A0
---
Common to position and scale expressions:

L=3DthisComp.layer("3d layer");
R=3DL.sourceRectAtTime(time,false);
UL =3D L.toComp([R.left,R.top])= ;
UR =3D L.toComp([= R.left+R.width,R.top]);
LR =3D L.toComp([R.left+R.width,R.top+R.height]);
LL =3D L.toComp([R.left,R.top+R.height]= );
maxX =3D Math.ma= x(UL[0],UR[0],LR[0],LL[0]);
minX =3D Math.min(UL[0],UR[0],LR[0],LL[0]);
maxY =3D Math.max(UL[1],UR[1],LR[1],LL[1]= );
minY =3D Math.mi= n(UL[1],UR[1],LR[1],LL[1]);

Add this for position:

[maxX+minX,max= Y+minY]/2;

Add this for scale:

w =3D maxX - minX;
h =3D maxY - minY;
[(w/width),h/height]*100

Dan=C2=A0=C2=A0
---
--000000000000165907056c5186bb--