Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Movement from a Parented layer to 3d stroke

  • Movement from a Parented layer to 3d stroke

    Posted by Mac Lad on April 9, 2018 at 7:44 pm

    Hi Guys,
    I have a 3d layer which is parented to a 3d null which is animated along position and rotation. Basically, 3d Layer is a Mobile Comp. I also have a layer which has a 3d stroke effect on it. I have already added toWorld expression to the position of xy and z in the effect which traces back the world position of the mobile. When I add below expression to the rotation it works fine but gets crazy when I add a value to it at the end.
    For rotation in x
    L = thisComp.layer(“Child Layer”);
    s = L.scale/100;
    u = L.toWorldVec([s[0],0,0]);
    v = L.toWorldVec([0,s[1],0]);
    w = L.toWorldVec([0,0,s[2]]);
    sinb = clamp(w[0],-1,1);
    b = Math.asin(sinb/thisComp.pixelAspect);
    cosb = Math.cos(b);
    if (Math.abs(cosb) > .0005){
    c = -Math.atan2(v[0],u[0]);
    a = -Math.atan2(w[1],w[2]);
    }else{
    a = Math.atan2(u[1],v[1]);
    c = 0;
    }
    x=radiansToDegrees(a);

    For rotation in y
    L = thisComp.layer(“Child Layer”);
    s = L.scale/100;
    u = L.toWorldVec([s[0],0,0]);
    v = L.toWorldVec([0,s[1],0]);
    w = L.toWorldVec([0,0,s[2]]);
    sinb = clamp(w[0],-1,1);
    b = Math.asin(sinb/thisComp.pixelAspect);
    cosb = Math.cos(b);
    if (Math.abs(cosb) > .0005){
    c = -Math.atan2(v[0],u[0]);
    a = -Math.atan2(w[1],w[2]);
    }else{
    a = Math.atan2(u[1],v[1]);
    c = 0;
    }
    y=radiansToDegrees(b);

    For rotation in z
    L = thisComp.layer(“Child Layer”);
    s = L.scale/100;
    u = L.toWorldVec([s[0],0,0]);
    v = L.toWorldVec([0,s[1],0]);
    w = L.toWorldVec([0,0,s[2]]);
    sinb = clamp(w[0],-1,1);
    b = Math.asin(sinb/thisComp.pixelAspect);
    cosb = Math.cos(b);
    if (Math.abs(cosb) > .0005){
    c = -Math.atan2(v[0],u[0]);
    a = -Math.atan2(w[1],w[2]);
    }else{
    a = Math.atan2(u[1],v[1]);
    c = 0;
    }
    z=radiansToDegrees(c);

    So by adding these expressions, I get my 3d stroke parallel to the mobile so to work it as a speed line rotating around I need to add 90 to the end value of x rotation or in y..here it becomes crazy and that’s where I need some expression help
    Is there any other way to solve this problem…?

    Kalleheikki Kannisto replied 8 years, 3 months ago 2 Members · 1 Reply
  • 1 Reply
  • Kalleheikki Kannisto

    April 13, 2018 at 5:56 pm

    Any chance of getting an image of what you currently have and what you want to change in it? My abstract conceptual inclination is to suggest a child null or layer rotated to the position you want, but I don’t really have a clear picture of what the exact issue is.

    Kalleheikki Kannisto
    Senior Graphic Designer

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