Mailing List AE-List@media-motion.tv ? Message #48234
From: Darby Edelen <dedelen@gmail.com>
Subject: Re: [AE] Rotation Expression Problem
Date: Sun, 24 Mar 2013 15:12:40 -0700
To: After Effects Mail List <AE-List@media-motion.tv>, mylenium@mylenium.de <mylenium@mylenium.de>
Indeed, you can most likely use the vector functions to do this and it will depend some on your set up.  That said, in 2D this seems to work pretty well on the "guy" layer's rotation:

floor = thisComp.layer("Floor");
ladder = thisComp.layer("Ladder");
v = floor.toWorldVec([1,0,0]);
r = ladder.fromWorldVec(v);
radiansToDegrees(Math.atan2(r[1],r[0])) + value;

Including the "+ value" at the end should allow you to offset from a direct perpendicular orientation to the floor by changing the rotation value itself.  In 3D things get a little more complicated because you really have 2 axes to consider.  I modified the above and got close by applying it to Orientation but it's not a perfect solution, it may work in your case:

floor = thisComp.layer("Floor");
ladder = thisComp.layer("Ladder");
v = floor.toWorldVec([1,0,0]);
r = ladder.fromWorldVec(v);
lookAt([0,0,0], r);

Someone with some more vector math chops might have a better solution in 3D.
 
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to ListMaster