Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Getting Velocity from a layer that’s parented to a layer, that is also parented.

  • Getting Velocity from a layer that’s parented to a layer, that is also parented.

    Posted by Meng Zhiqun on June 25, 2019 at 9:27 am

    Hi,

    If A is parented to B, I know how to get B’s velocity,

    However, if A is parented to B and B is parented to C, and if C is the layer that has animations, is there any way I can get B’s velocity’s value?

    Using C’s velocity doesn’t work for me. It needs to be B, as C is a IK handle which drives movements of B, which is the midjoint.

    Thanks in advance!

    Filip Vandueren replied 6 years, 10 months ago 2 Members · 3 Replies
  • 3 Replies
  • Filip Vandueren

    June 26, 2019 at 10:32 am

    I would split the problem into two parts. First make another null layer and for position use a toWorld() or toComp() expression that references your layerB.
    Then in another expression get the velocity of that null layer’s absolute position

  • Meng Zhiqun

    July 3, 2019 at 5:56 am

    Could you explain the part about “make another null layer and for position use a toWorld() or toComp() expression that references your layerB”?

    how do I get it to reference to layerB if:
    1. parenting to layerB doesn’t inherit any position change, as layerB is a child of another parent, which doesn’t give LayerB position change in the first place?
    2. pickwhipping position to layerB also doesn’t inherit any position change?

    Thanks!

  • Filip Vandueren

    July 9, 2019 at 2:36 pm

    Hi Meng,

    it’ll work because this is precisely what the layer space transform functions such as toWorld() are designed for, to bypass the relative position (to parents, to scaling etc.) and get the raw position in 2D or 3D space.

    The confusing part is you should not use it like this:
    toWorld(l.position);

    You take a point on your desired layer, it could be [0,0] or the anchorPoint, or anything, and you ask where in the 3D world that point is (toWorld), or at what 2D pixel (toComp) of the comp it is.
    You call it as a method of the layer you’re interested in

    for example:

    l=thisComp.layer(“layerB”);
    l.toWorld(l.anchorPoint);

    add that expression to the position of a null,

    then get the velocity of this new null’s position inside your expression with

    thisComp.layer(“Null 1”).transform.position.velocity;

    That will hget the post-expression result.

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