[Mark Warner] “Thank you. Really nice solution for 2d! How do I get that z depth in there?”
You can adjust the size of the line based on how near/far it is from the camera.
Here’s an updated expression for the start point, end point, start size and end size:
Start:
l = thisComp.layer("StartNull");
fromComp(l.toComp(l.anchorPoint));
End:
l = thisComp.layer("EndNull");
fromComp(l.toComp(l.anchorPoint));
Start Size:
s = value;
l = thisComp.layer("StartNull");
c = thisComp.activeCamera;
p = l.toWorld(l.anchorPoint);
f = c.cameraOption.zoom;
dist = p - c.toWorld([0,0,0]);
vec = c.toWorldVec([0,0,1]);
dist = dot(dist, vec);
s * f / dist;
End Size:
s = value;
l = thisComp.layer("EndNull");
c = thisComp.activeCamera;
p = l.toWorld(l.anchorPoint);
f = c.cameraOption.zoom;
dist = p - c.toWorld([0,0,0]);
vec = c.toWorldVec([0,0,1]);
dist = dot(dist, vec);
s * f / dist;
This should give you dynamic resizing of the beam based on its “3D” position. Note, though, that the position expression only works until you pass the camera beyond the Nulls… you’ll definitely notice it when this happens. It might require that you rethink your animation if you had been planning to do a truck in past the nulls.
Darby Edelen
NVIDIA
Santa Clara, CA