-
2d bounding box from 3d layer
Hello folks,
I’m trying to create a bounding box of a 3d solid, with a 2d solid which should stick to the 3d layer and follow his scale on the relative x,y 2d space. I’m using this expression on a point control:
L=thisComp.layer(3d layer);
R=L.sourceRectAtTime(time,false);
N=L.toComp([R.left+L.width,R.top+L.height])-L.toComp(anchorPoint);
O=L.toComp([R.left-L.width,R.top+L.height])-L.toComp(anchorPoint);[Math.max(Math.abs(N[0]), Math.abs(O[0])), Math.max(Math.abs(N[1]), Math.abs(O[1]))]
this on the scale of the 2d layer
P=thisComp.layer(ref).effect(“Point Control”)(“Point”)[0];
J=thisComp.layer(ref).effect(“Point Control”)(“Point”)[1];
F = linear(P,0,1920,0,100);
G = linear(J,0,1080,0,100);
and this on his positions:
L = thisComp.layer(index -1);
L.toComp([L.width/2, L.height/2, 0]);
everything seems to work (scale, rotations, positions and camera movement) until the Z axis of the 3d layer is facing the camera.
When it doesn’t, it continues to follow the transformations, more or less, but not precisely around the extremes of my layer.Any clues? I would be immensely grateful.
☺
Thanks
Daniele