Return-Path: Received: from mail-ob0-f169.google.com ([209.85.214.169] verified) by media-motion.tv (CommuniGate Pro SMTP 4.2.10) with ESMTP-TLS id 4849471 for AE-List@media-motion.tv; Mon, 17 Sep 2012 20:38:27 +0200 Received: by obhx4 with SMTP id x4so9223907obh.28 for ; Mon, 17 Sep 2012 11:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=lndI9wHQbFf90i0EdGtzeUdL8NEwfzTr8kQBc7iQWZA=; b=IWUOHXedilS/oXR57T8+TDZu7i0ev4+Hhaclb3+V9J1Rqbu1qoVt5qFy6uPSVyc/JJ gTm5Yl6RO1BBW6Taa1cjlOz7m/AWsd0doi47TueNQ4qf8fyIqU0d43TRG6ZTuoGRyXoP Ddlfp4oOErtqjxva0jHXaz2LWZUNqR0+qNOn4JLN/3YwMTF1WgkuvOOvEwegDutLApB5 ivhhQPw9E7LaNMo6droJhJZjiGpxyzNktRfNgOIkVlvDVczE3Sz0oMOBKsmDGmi32MrY EGIwCCDIy3UwWpG6TOR1u2d0gmzpBr6phc+32juYoxBRBPxNPyBpHjxAoAiB6hX8gOtX Ku8w== Received: by 10.60.172.15 with SMTP id ay15mr12548219oec.64.1347907192360; Mon, 17 Sep 2012 11:39:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.60.28.229 with HTTP; Mon, 17 Sep 2012 11:39:32 -0700 (PDT) In-Reply-To: References: From: Byron Nash Date: Mon, 17 Sep 2012 14:39:32 -0400 Message-ID: Subject: Re: [AE] Layer Space transform onto parented layers To: After Effects Mail List Content-Type: multipart/alternative; boundary=bcaec54faf2c640e4104c9ea1906 --bcaec54faf2c640e4104c9ea1906 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Weird, it seems to take the expression but then I get this error: After Effects warning: layer to world matrix isn=92t invertible in fromWorl= d Expression disabled. Error occurred at line 2. Comp: =91MHI_logo_Layers 2=92 Layer: 17 (=91red arrow 2=92) Property: =91Orientation=92 On Mon, Sep 17, 2012 at 2:12 PM, Dan Ebberts wrote: > This should give you the position: > > L =3D thisComp.layer("parented null"); > L.toWorld(L.anchorPoint); > > And this should give you the orientation: > > L =3D thisComp.layer("parented null"); > u =3D L.toWorldVec([1,0,0]); > v =3D L.toWorldVec([0,1,0]); > w =3D normalize(L.toWorldVec([0,0,1])); > > sinb =3D clamp(w[0],-1,1); > b =3D Math.asin(sinb); > cosb =3D Math.cos(b); > if (Math.abs(cosb) > .0005){ > c =3D -Math.atan2(v[0],u[0]); > a =3D -Math.atan2(w[1],w[2]); > }else{ > a =3D (sinb < 0 ? -1 : 1)*Math.atan2(u[1],v[1]); > c =3D 0; > } > [radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)] > > > Dan > > > *From:* Byron Nash > *Sent:* Monday, September 17, 2012 10:20 AM > *To:* After Effects Mail List > *Subject:* Re: [AE] Layer Space transform onto parented layers > > How about the other direction? I have a layer that is parented inside a > heirarchy. I need to match another layer to it that is unparented. Most o= f > the motion is from the parent layers rotation. Also, I have moved the > anchorpoints around so they are not in the center. I am trying different > combinations of toWorld and fromWorld and can't seem to get it working. I > need another one on the rotation to get it oriented correctly, would that > go on Orientation or the individual axes? > > On Wed, Sep 5, 2012 at 6:06 PM, Darby Edelen wrote: > >> This line: >> >> parent.fromWorld(p); >> >> Should work no matter how deeply parented the null is. The reason being >> that it will take a world position (p) and transform it into the >> local/layer space of the current layer's parent. This is exactly how a >> child's position is defined (i.e. in the parent's local/layer space). >> >> The part that is really important is the parent.fromWorld(). You could >> put any world coordinate in there and it should work. >> On Sep 5, 2012 11:19 PM, "Byron Nash" wrote: >> >>> Thanks for the expression. I haven't had a chance to test it yet. I did >>> not think of stacking the toWorld and fromWorld. What if the parented n= ull >>> is several parent layers deep? >>> >>> On Wed, Sep 5, 2012 at 12:39 PM, Darby Edelen wrote= : >>> >>>> In order to transform the parented null to the unparented null you'll >>>> need to use an expression in this form; applied to the parented null's >>>> position: >>>> >>>> l =3D thisComp.layer("unparented null"); >>>> p =3D l.toWorld(l.anchorPoint); >>>> parent.fromWorld(p); >>>> >>>> I can't confirm this is correct at the moment, but it should at least >>>> be close. >>>> On Sep 5, 2012 5:37 PM, "Byron Nash" wrote: >>>> >>>>> I need to "constrain" one null to another with Layer Space transforms= . >>>>> The null that I am matching FROM is not parented at all. The one I am >>>>> wanting to add the expression TO is parented several levels deep. I h= ave >>>>> tried various combinations of toComp, fromComp, toWorld, fromWorld, e= tc... >>>>> What is the proper way to apply a comp position value to a layer that= is >>>>> inheriting many levels of offsets? >>>>> >>>>> Thanks! >>>>> >>>> >>> > --bcaec54faf2c640e4104c9ea1906 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Weird, it seems to take the expression but then I get this error:
=
After Effects warning: layer to world matrix isn=92t inverti= ble in fromWorld
Expression disabled.

Er= ror occurred at line 2.
Comp: =91MHI_logo_Layers 2=92
Layer: 17 (=91red arrow 2=92)<= /div>
Property: =91Orientation=92




On Mon, Sep 17, 2012 at 2:12 PM= , Dan Ebberts <debberts@comcast.net> wrote:
This should give you the position:
=A0
L =3D thisComp.layer("parented null");
L.toWorld(L.anchorPoint);
=A0
And this should give you the orientation:
=A0
L =3D thisComp.layer("parented null");
u =3D L.toWorldVec([1,0,0]);
v =3D L.toWorldVec([0,1,0]);
w =3D normalize(L.toWorldVec([0,0,1]));
=A0
sinb =3D clamp(w[0],-1,1);
b =3D Math.asin(sinb);
cosb =3D Math.cos(b);
if (Math.abs(cosb) > .0005){
=A0 c =3D -Math.atan2(v[0],u[0]);
=A0 a =3D -Math.atan2(w[1],w[2]);
}else{
=A0 a =3D (sinb < 0=A0 ?=A0 -1 : 1)*Math.atan2(u[1],v[1]);
=A0 c =3D 0;
}
[radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)]
=A0
=A0
Dan
=A0
=A0
From: Byron Nash
Sent: Monday, September 17, 2012 10:20 AM
Subject: Re: [AE] Layer Space transform onto parented=20 layers
=A0
How=20 about the other direction? I have a layer that is parented inside a heirarc= hy. I=20 need to match another layer to it that is unparented. Most of the motion is= from=20 the parent layers rotation. Also, I have moved the anchorpoints around so t= hey=20 are not in the center.=A0 I am trying different combinations of toWorld and= =20 fromWorld and can't seem to get it working. I need another one on the r= otation=20 to get it oriented correctly, would that go on Orientation or the individua= l=20 axes?

On Wed, Sep 5, 2012 at 6:06 PM, Darby Edelen <d= edelen@gmail.com> wrote:

This line:

parent.fromWorld(p);

Should work no matter how deeply parented the null is. The reason bein= g=20 that it will take a world position (p) and transform it into the local/la= yer=20 space of the current layer's parent. This is exactly how a child'= s position is=20 defined (i.e. in the parent's local/layer space).

The part that is really important is the parent.fromWorld(). You could= put=20 any world coordinate in there and it should work.

On Sep 5, 2012 11:19 PM, "Byron Nash"= ; <byronnash@gm= ail.com>=20 wrote:
Thanks for the expression. I haven&= #39;t had a chance to test=20 it yet. I did not think of stacking the toWorld and fromWorld. What if = the=20 parented null is several parent layers deep?

On Wed, Sep 5, 2012 at 12:39 PM, Darby Edele= n <dedelen@gmail.com> wrote:

In order to transform the parented null to the unparented null you= 'll=20 need to use an expression in this form; applied to the parented null&= #39;s=20 position:

l =3D thisComp.layer("unparented null");
p =3D=20 l.toWorld(l.anchorPoint);
parent.fromWorld(p);

I can't confirm this is correct at the moment, but it should a= t least=20 be close.

On Sep 5, 2012 5:37 PM, "Byron Nash&q= uot; <byronnash= @gmail.com> wrote:
I need to "constrain"= one null to another with Layer=20 Space transforms. The null that I am matching FROM is not parented = at=20 all. The one I am wanting to add the expression TO is parented seve= ral=20 levels deep. I have tried various combinations of toComp, fromComp,= =20 toWorld, fromWorld, etc... What is the proper way to apply a comp= =20 position value to a layer that is inheriting many levels of offsets= ?=20
=A0
Thanks!

=A0

--bcaec54faf2c640e4104c9ea1906--