Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Translate multiple null position, scale, rotation into a single null


  • Translate multiple null position, scale, rotation into a single null

    Posted by Jim Hopper on March 23, 2023 at 6:48 pm

    I have an element 3d layer that is controlled by a null. That null is controlled by a secondary null which can change the position, scale or rotation. At the end of the animation I have about 5 nulls that are parented to eachother in order.

    The script that I am using you place it on a “controll null” we’ll call it. It then refrences the FIRST null that the Element 3D layer is parented to:

    Once parented it will translate ALL of the nulls into data for this single null.

    Here is the current expression for Position:

    L = effect("Layer Control")("Layer");


    And here is the script for Orientation:

    L = effect("Layer Control")("Layer");

    u = (L.toWorldVec([1,0,0]));

    v = (L.toWorldVec([0,1,0]));

    w = normalize(L.toWorldVec([0,0,1]));

    sinb = clamp(w[0],-1,1);

    b = Math.asin(sinb);

    cosb = Math.cos(b);

    if (Math.abs(cosb) > .0005){

    c = -Math.atan2(v[0],u[0]);

    a = -Math.atan2(w[1],w[2]);


    a = (sinb < 0 ? -1 : 1)*Math.atan2(u[1],v[1]);

    c = 0;



    But I realized I dont have a script for Scale. My knowledge is lacking in this department so I am not sure how to add Scale to the tracked data.

    I hope this makes sense!

    Thanks for the help!

    Dan Ebberts
    replied 1 year, 2 months ago
    2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    March 23, 2023 at 9:21 pm

    I think you have to iterate through the parent chain, so it would be like this:

    L = thisComp.layer("Layer Control");
    s = L.scale;
    while (L.hasParent){
    L = L.parent;
    s = [s[0]*L.scale[0]/100,s[1]*L.scale[1]/100];

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