Monday, July 21, 2014

Finding the Global Position in 3d of a Parented 3D Null

Trapcode Particular can use Position XY and Position Z as an emitter location, but it's not possible to just pickwhip a parented null's position, since that's just an offset from the parent layer.


For Particular, paste the following:


Position XY:
the3Dchild = thisComp.layer("Null 2"); posXY = the3Dchild.toWorld(the3Dchild.anchorPoint); [posXY[0], posXY[1]];



Position Z:
the3Dchild = thisComp.layer("Null 2"); posZ = the3Dchild.toWorld(the3Dchild.anchorPoint)[2];



For a plain old 3d Layer, we can use:



Position:
the3Dchild = thisComp.layer("Null 2"); the3Dchild.toWorld(the3Dchild.anchorPoint);


Scale:
the3Dparent = thisComp.layer("Null 1").transform.scale;
the3Dchild = thisComp.layer("Null 2").transform.scale;
[(the3Dchild[0] * the3Dparent[0])/100, (the3Dchild[1] * the3Dparent[1])/100, (the3Dchild[2] * the3Dparent[2])/100 ];

Rotation:
the3Dparent = thisComp.layer(Null 1").transform.rotation;
the 3Dchild = thisComp.layer("Null 2").transform.rotation;
the3Dparent + the3Dchild;