I posted this question over at the Adobe forum, and the inimitable Dan Ebberts came through with flying colors. For anyone else trying to solve this problem, here’s the answer:
If, like me, you have your cameras set to auto-orient: off, you can ignore the POI expression. I can vouch for that setup. Worked like a charm for me.
After applying the expressions, convert all to keyframes, and you’ll have a perfect objective data set to hand off to your 3D program.
// position
C = thisComp.layer("Camera 1");
C.toWorld([0,0,0])
// point of interest
C = thisComp.layer("Camera 1");
C.toWorld(C.pointOfInterest)
// orientation
C = thisComp.layer("Camera 1");
u = C.toWorldVec([1,0,0]);
v = C.toWorldVec([0,1,0]);
w = C.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)]