-
Translate multiple null position, scale, rotation into a single null
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");
L.toWorld(L.anchorPoint);
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]);
}else{
a = (sinb < 0 ? -1 : 1)*Math.atan2(u[1],v[1]);
c = 0;
}
[radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)]
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!