Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Tracking Child Layers – 1 Dimension

  • Tracking Child Layers – 1 Dimension

    Posted by S.j. Deluise on October 26, 2010 at 2:50 pm

    I’m using the following expression track a child layer that is parented to a null:

    c = thisComp.layer(“box”);
    c.toWorld(thisComp.layer(“box”).transform.anchorPoint);

    The expression works fine, except I only want to track the X and Z values. It’s a shadow that’s following under an object as it flies into the distance – the object casting the shadow moves up and down, but I want the shadow locked in its Y position.
    (The reason I’m not using a light to cast a shadow is that the ground is a stock video and not an actual 3D surface that accepts a real shadow, so I’m using an artificial shadow)

    S.j. Deluise replied 15 years, 6 months ago 3 Members · 4 Replies
  • 4 Replies
  • Michael Szalapski

    October 27, 2010 at 1:15 pm

    Why not have a null track that child object with that expression, then have your shadow reference the null object’s position points for the x and z?

    – The Great Szalam
    (The ‘Great’ stands for ‘Not So Great, in fact, Extremely Humble’)

    No trees were harmed in the creation of this message, but several thousand electrons were mildly inconvenienced.

  • S.j. Deluise

    October 27, 2010 at 10:19 pm

    Great suggestion and a successful one at that, thanks!

    It’d still be useful to know if there is a way to modify that original expression and cut out the middle man. It’d be one less layer. But in the meantime, the workaround is good for me.

  • Dan Ebberts

    October 27, 2010 at 11:01 pm

    This should work:

    c = thisComp.layer(“box”);
    p = c.toWorld(c.transform.anchorPoint);
    [p[0],value[1],p[2]]

    Dan

  • S.j. Deluise

    November 8, 2010 at 10:29 pm

    Works perfectly, thanks so much!

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