ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Movement from a Parented layer to 3d stroke

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mac Lad
Movement from a Parented layer to 3d stroke
on Apr 9, 2018 at 7:44:53 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...?


Return to posts index

Kalleheikki Kannisto
Re: Movement from a Parented layer to 3d stroke
on Apr 13, 2018 at 5:56:15 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]