Good old toComp() ?!. Create a 3D layer (Null) as a dummy for the center of the sphere, then use this:
I'm bringing this back because I have the smae issue and that expression doesn't seem to do the trick. Anyone else have any ideas?
It's a little more complicated than a single expression. You have to tie the X and Y rotation to the camera position, then if you want to mimic a light in the composition you have to tie the light height and light direction to the light position.
A quick Google search for "attach camera to cc sphere" brings up this set of expressions from AE Enhancers. Interestingly enough the same page is listed in the AE Help files under Tips and online resources for moving and animating cameras and lights as a tip from Rich Young.
I've got another version, using the same technique but a little different language. These expressions should solve your problems as written without any need to rename layers from their default names.
Maybe i'll try to describe my situation a little more.
I have a CC sphere and a camera. I'm trying to make the camera fly into the sphere. but when I move the camera in, the ccshpere stays put. (no lights)
I just did it and it worked.
create new Layer / Solid
Assign CC Sphere to that layer
** Turn on 3D switch for that layer **
Add Camera and zoom in. Sphere grows in size. Im not sure what the significance of "no lights " is.
To change the radius based on the camera position you need to add the expressions in my previous post to X and Y rotation then you need to calculate the distance between the camera and the sphere. The sphere is always going to be at a world Z value of 0 because it's a 2D layer so it's faking the z location.
To measure the distance between the camera and the you use the length(value1, value2). To set up a variable ratio you divide the distance by the zoom value +1 (to avoid a divide by zero error). The expression is then added to the radius property.
Here's what it looks like:
c =thisComp.activeCamera.toWorld([0,0,0]); d = length(c, position); z = thisComp.activeCamera.zoom; newR = value * z/(d+1)
That's about all there is to it. If you want to fly past a planet or move it off center just turn the planet layer into a 3D layer. The math is close, but not perfect. I've never needed a project that required perfect.
Awesome! Works great, thank you.