Copy link to clipboard
Copied
I have a camera and an image in 3D. I play around with the camera position. Now I want to frame the camera square to the image (target), as it was at the beginning. If I do it manually, it's never perfect. I know there's a way to do this automatically, just don't remember how. Thanks.
I see now the shift parenting does not create a keyframe so let me fix my suggestion.
In fact here's 2 suggestions
suggestion #1
Copy link to clipboard
Copied
this would have been easier if you set your orbit rig your camera from the start.
1. Create a 50mm Camera
2. right click on the camrea -> camera->create orbit null
3. parent the null while holding shift to the location of your layer. it will get it's transform values and be at it's exact position
you can see here in this Creative Cow's Andrew Davis tutorial how he demonstrate using a null controller to shift the camera's position to the exact focal point location of a 3d layer. Working in 3D Part 3: Simple & Fast Camera Animation
Copy link to clipboard
Copied
Thank you Roei,
I did try this. The camera does move towards the object but it doesn't move square to it. What am I doing wrong?
Copy link to clipboard
Copied
As you can see here, both the camera orbit null and the red rectangle have the same coordinates. However, the camera is not looking square at the object.
Copy link to clipboard
Copied
Your workflow still isn't right.
For a two node camera:
This will set the layer parallel to the film plane.
For a one node camera just make sure that Auto-Orientation is set to off and the Rotation and Orientation of the camera and the matches the Orientation and Rotation of the layer.
For a 2 node camera you can also add an expression that Dan Ebberts came up with to the Orientation property of the layer providing that the Rotation values for the layer are all zero.
L = thisComp.activeCamera;
u = fromWorldVec(L.toWorldVec([1,0,0]));
v = fromWorldVec(L.toWorldVec([0,1,0]));
w = normalize(fromWorldVec(L.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)]
I have this expression saved as one of my custom animation presets and I use it quite often. I suggest that you start building up a library of useful animation presets.
The last quick option which may produce some unexpected results in the animation is to have Auto-orient set to Orient to Camera and then use the Transform Menu or the keyboard shortcut Ctrl/Cmnd + Home to center the layer in the current view. If you have position keyframes for your layer you'll get a new position keyframe. If you do not then the first position of the layer relative to the camera animation will change and things will get fouled up. I never use this technique on an animated layer but I will use it quite often to properly position a new layer in a composition that already has a camera move. It's a very handy way to get the layer centered in the camera view so you can start a new animation.
Copy link to clipboard
Copied
All these options are interesting. However, what they do is to orient the layer to the camera. In my case, I want to orient the camera to the layer.
Here's my workflow:
1. I create a 3D layer with a rectangle.
2. I create a 2-node camera
3. I move the camera away (in Z) and than rotate it.
Now I want to animate the camera while it zooms back to the rectangle, square to it and full screen. I'm sure there must be a function to do this automatically.
Copy link to clipboard
Copied
You are way over thinking this problem.
Set a keyframe for your original camera position. Copy the keyframe (Ctrl/Cmnd + c). Animate the camera to the next to last position. Move the CTI (current time indicator) to the spot where you want the camera to return to being centered on the layer, select position and paste (Ctrl/Cmnd + v). If you want to make Z adjustment from that point feel free to do so.
Copy link to clipboard
Copied
Thanks Rick. I was able to do this manually. I just thought there could be a function where you told the camera to automatically zoom in square on a layer. I guess it has to be done manually.
Copy link to clipboard
Copied
I see now the shift parenting does not create a keyframe so let me fix my suggestion.
In fact here's 2 suggestions
suggestion #1
suggestion #2
here's a project file showing both methods: CameraToRectangle.aep - Google Drive
BTW theres a plugin called "Sure Target", you might want to try it too.