-
get 3D position info in outer comp for 2d object in nested comp
Example file attached in link: Ignore the text readouts they are just for me checking values. I’ve done it in CS6 so it’s more compatible for everyone who hasn’t upgraded yet. But I will be doing this in 2018 so if there is a newer library that will allow other methods, I’m game. – magicallyGetPosition()?
I have a child 2D object (object1) moving around in a preComp. (you can slide the time marker to see this happen)
preComp is a 3D layer in the outer Comp called “SimpleToOuterWorld”. The preComp is a smaller comp than the outer comp.
I want to get the 3D position of object1 in the outerComp when the preComp layer is moved and scaled.
I can get this far, no issues. (although there must be a better way)The problems start when I move the preComp layer and push it back into z depth.
A layer called tracker receives the position data and follows the nested object1 just fine as long as there is no z translation.
I thought once I got tracker able to work with position and scale, I could project that point to the outer comp’s 2D space (or even world space) and then just replace the z position with the z position from the preComp layer. I wasn’t sure how the position data would be presented to the camera once preComp had started into the distance.
I also tried calcing a vector from the 2D position to the virtual 3D position but no luck (and isn’t that what all these world space transforms are doing anyway?)The other comp is just another version of the outer comp called “finalPostitionAndScale” and it shows where preComp needs to move to (position,scale and position in z) and how the tracker and a 3D version of that tracker does not stick to the position of Object1.
I’ve had to use some cheats to get to this point – Tracker is parented to the preComp layer. I’d rather it not be because I’m going to use the final position data for a Particular system (2D layer, but 3D emitter position) – so the Particular layer can’t scale and move with the moving preComp layer. And once the tracker is following the object1 around while preComp is at its z depth I wasn’t sure if I could then do a spacetransform and tease its world position out. (relative to the outer comp)
Is there a solution to this? Is there a more elegant solution to get to the point I already have?
Thanks