Greetings Joao,
Sorry it took so long to get back to you. Hopefully this is still helpful. I’ve just revamped these expressions for a 3d line and maybe it will help.
First, create a shape rectangle layer, make it 3d, give it a fill, place it between any two 3d layers (so for example layer 1 is a 3d layer, layer would be this layer, and layer 3 would be another 3d layer).
Next, give it two expression sliders. Call the first one LINE LENGTH MODIFIER, the second LINE WIDTH. For now, give those the values 1 and 4 respectively.
Nexy, add these expressions:
To the rectangle’s size property:
x = (effect(“LINE LENGTH MODIFIER”)(“Slider”));
point1 = ((thisComp.layer(this_layer,-1).position)*x);
point2 = ((thisComp.layer(this_layer,1).position)*x);
y = (length(point1, point2))*(x);
w = effect(“LINE WIDTH”)(“Slider”);
[y, w]
To the position property of the layer:
a = thisComp.layer(this_layer,-1).transform.position[0];
b = thisComp.layer(this_layer,1).transform.position[0];
c = (a+b)/2;
d = thisComp.layer(this_layer,-1).transform.position[1];
e = thisComp.layer(this_layer,1).transform.position[1];
f = (a+b)/2;
g = thisComp.layer(this_layer,-1).transform.position[2];
h = thisComp.layer(this_layer,1).transform.position[2];
i = (a+b)/2;
[c, f, i]
On the layer’s orientation property:
lookAt (thisComp.layer(this_layer,-1).transform.position, thisComp.layer(this_layer,1).transform.position)
FINALLY, set the layer’s rotation to 90.
You can copy and paste the whole line layer between any two 3d layers and it will automatically adjust to the new layers.
Viola.
================================================
YOU can help save TimeSpace. Join the Chronos Protectorate!
https://www.95ers.com
https://www.SpaceAceMedia.com