-
Trouble With Auto-Orient and Z-Rotation
Hi everyone!
I can’t warp my head around it:
I’m moving a camera parented to a null in various directions through a 3D space. I want a 3D text layer face constantly towards the camera and also keeping the angle to the borders of the camera’s frame.
Auto-orientaion makes no use, the text spins around its z-axis depending on the position of the camera. I made various attempts tweeking around with different expressions both in orientation and rotation with auto-orientation switched ON and OFF. Only poor results.
Might there be a solution with auto-orient ON and an expression on z-rotation? Or is there something I am missing compleatly? Any help in this case will be appreciated!
(Before had I parented the camera to a null all expressions worked very fine:
Orientaion:
L = thisComp.layer(“Null 45°”);
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;
}
[radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)]
Scaling:
dist = length(thisComp.layer(“45°”).position, position);
S=dist/14;
[S,S,S]Both expressions by Dan Ebberts, thanks to him, very usefull fine stuff!)
Chears
SebastianSebastian Martinez