I have a comp with a camera, and a layer positioned in 3D. What I would like to do is to move the camera around, and calculate the angle of the object relative to the camera.
After some googling I found this piece of code on CreativeCow:
Code: Select all
C = thisComp.layer("Camera 1");
v1 = normalize(position - C.position)
v2 = C.toWorldVec([0,0,1]);
radiansToDegrees(Math.acos(dot(v1,v2)))
Basically what I am looking for is to change the object's opacity depending on its angle and distance to the camera. Could someone help me out in the right direction?
Thank!
P.