Control camera in other comps
Hi, I am trying to control the camera in my nested comp with the camera in my "Main" comp, I have the following expression applied to the nested comps camera's position-
CL = comp("Main").layer("Camera 1"); CL.toWorld([0,0,0]);
And, this to it's orientation:
CL = comp("Main").layer("Camera 1");
getGlobal Orientation(CL, time);
function getGlobalOrientation(aLayer, aTime) {
C = aLayer;
aTime = (aTime ? aTime : time);
ghi=normalize(C.toWorldVec([1,0,0], aTime));
def=normalize(C.toWorldVec([0,1,0], aTime));
abc=normalize(C.toWorldVec([0,0,1], aTime));
A=abc[0];B=abc[1];C=abc[2]; D=def[0];E=def[1];F=def[2]; G=ghi[0];H=ghi[1];I=ghi[2];
OrX=Math.atan2(-B,C);OrY=Math.asin(A);OrZ=Math.atan2(-D,G);
degr=180/Math.PI;OrX=OrXdegr;OrY=OrYdegr;OrZ=OrZ*degr;OrX+value;
return([OrX, OrY, OrZ]);
}
The position works, but the orientation is throwing up an error on line 2. Have tried changing settings to Java from legacy
Thanks for any help
