-
3D Camera To Psunami Camera (3D rotation matrix)
Hi all.
I am trying to write expressions for the Tilt Pan And Roll controllers within the Psunami plugin so that they correspond to a (non auto orientated) camera in the composition.
Originally I was just using something like this:
// Pan
camL = thisComp.layer(“cam”);
targL = thisComp.layer(“target”);pos1 = camL.toWorld(camL.anchorPoint);
pos2 = targL.toWorld(targL.anchorPoint);orient1 = lookAt(pos1, pos2);
orient1[1]
//However, this code obviously breaks when the camera position goes through an axis.
I had a little dig around and found this thread from here:
https://forums.creativecow.net/thread/227/8478#8497
… which is really helpful (I was unaware of the toWorldVec function and I’m still getting my head round it). From that thread I have used this code to determine the Psunami Pan property:
// Pan
C = thisComp.activeCamera;V = C.toWorldVec([1,0,0]);
-radiansToDegrees(Math.atan2(V[2], V[0]))
//This works a treat but I have to admit that I am completely stumped as to what I exactly need to change to get this working for the Tilt and Roll properties. Can anyone help?
Many thanks,
JamieJimJam•Graphics
https://www.jimjamgraphics.com/