When I import data from a 3D soft or from a 3D tracker into AE, I need to place and orient a layer to some nulls coming from the 3D data. Instead of adjusting this manually you can use the following expression. Remember that this expression uses three nulls/lights/layers that should be placed on top of the layer to be placed.
Position expression:
Code: Select all
a = thisComp.layer(thisLayer, -1).position;
b = thisComp.layer(thisLayer, -2).position;
c = thisComp.layer(thisLayer, -3).position;
(a+b+c)/3
This places the layer in the middle of the three points.
You then have to add an expression for the orientation :
Code: Select all
a = thisComp.layer(thisLayer, -1).position;
b = thisComp.layer(thisLayer, -2).position;
c = thisComp.layer(thisLayer, -3).position;
n = cross ((a-b),(a-c));
orientation+lookAt(a, n)
This will orient the layer to be parallel with the plane formed by the three points. You'll need to manually adjust the Z orientation though.
Any feedback or suggestions to make it better are really apreciated.
Donat