Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions get position of a precomped object

  • get position of a precomped object

    Posted by Anders Hattne on March 25, 2011 at 12:13 pm

    Hello,
    I’ve got this crane made in illustrator..
    It’s pretty big, scaled down to round 20% in a full HD comp (main comp). All the parts of the crane are parented to one and another controlable from the main comp with sliders.
    Also everything in the main comp is parented to a null so I can scale the scene up and down.
    I would like to have a null follow the position in main comp.
    I tried with toWorld and got the position quite offset. This in turn I tried to solv by subtracting ther crane’s position in the maincomp.
    BUT when scaling it all went a bit wrong.

    Is there a simple solution for getting the hooks position in the main comp or do I have to subtract with the cranes position and multiply with the scale etc?

    Thanks!

    http://www.ardillamedia.com

    Dan Ebberts replied 15 years, 5 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    March 25, 2011 at 2:33 pm

    The trick is to transform the hook’s position into its own comp’s world space with toWorld() and then transform that result from the inner comp’s layer space (as a layer in the main comp) to the main comp’s world space. It will look something like this, depending on how many levels of nested comps you have:

    L1 = comp(“Crane”).layer(“Hook”);
    P = L1.toWorld(L1.anchorPoint);
    L2 = thisComp.layer(“Crane”);
    L2.toWorld(P);

    You could probably also just parent a null to the appropriate spot within the main comp and use thisComp.layer(“Null 1”).toWorld([0,0,0]);

    Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy