baking camera for export - trouble with 3D rotations!
Posted: February 24th, 2008, 3:44 am
baking the AE camera for export to 3D packages - trouble with 3D rotation
I'm trying to share my AE camera with a number of 3D packages. What often helps is having a free camera that does not use a POI (target) or parenting before you export. So I was trying to write an expression to convert all values to global values to "unparent" my camera. The position so far works fine. I used Dan Ebberts' 2D Auto Orientation script for the rotations as a starting point...which works fine one at a time, but not when the the axes are combined. Does it not work because of the rotation order? Anyone tackled this before?
The layer "c" is my keyframeless child camera layer controlled by a parent null. Below are the expressions applied to the new free camera.
Position
L=thisComp.layer("c");L.toWorld(L.anchorPoint)
X Rotation
L = thisComp.layer("c");
u = L.toWorldVec([0,0,1]);
-radiansToDegrees(Math.atan2(u[1],u[2]))
Y Rotation
L = thisComp.layer("c");
u = L.toWorldVec([1,0,0]);
-radiansToDegrees(Math.atan2(u[2],u[0]))
Z Rotation
L = thisComp.layer("c");
u = L.toWorldVec([1,0,0]);
radiansToDegrees(Math.atan2(u[1],u[0]))
I'm trying to share my AE camera with a number of 3D packages. What often helps is having a free camera that does not use a POI (target) or parenting before you export. So I was trying to write an expression to convert all values to global values to "unparent" my camera. The position so far works fine. I used Dan Ebberts' 2D Auto Orientation script for the rotations as a starting point...which works fine one at a time, but not when the the axes are combined. Does it not work because of the rotation order? Anyone tackled this before?
The layer "c" is my keyframeless child camera layer controlled by a parent null. Below are the expressions applied to the new free camera.
Position
L=thisComp.layer("c");L.toWorld(L.anchorPoint)
X Rotation
L = thisComp.layer("c");
u = L.toWorldVec([0,0,1]);
-radiansToDegrees(Math.atan2(u[1],u[2]))
Y Rotation
L = thisComp.layer("c");
u = L.toWorldVec([1,0,0]);
-radiansToDegrees(Math.atan2(u[2],u[0]))
Z Rotation
L = thisComp.layer("c");
u = L.toWorldVec([1,0,0]);
radiansToDegrees(Math.atan2(u[1],u[0]))