Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions 3D Orientation from 2D Coordinates

  • 3D Orientation from 2D Coordinates

    Posted by Ecko Locko on September 25, 2016 at 9:10 pm

    Hello,

    I am trying to calculate the 3D orientation of a layer based on the 2D position 4 null objects (C: center, X, Y, Z).

    The idea is to calculate the position difference between C and other auto zero for orienting a 3D layer in each of their respective axes.

    For displaying the direction of the axes I think beam effects, the initial position will always effect the position C, the end correspond to the coordinates X, Y and Z.

    The aim is to represent the 3 axes in the composition based on the positions of the null objects, thus to define the orientation of another layer 3d to be similar to the perspective of the video. This idea arises because of the complication for a 3D tracking in the video and because it will be a repetitive task with very short-term projects, is geared to work in sports.

    So far I’ve got something that can help me but does not work as I would like, if anyone can help it would be appreciated if anyone is interested I can send you the project if necessary.

    Deputy applied to the 3D layer in your property Guidance and screen capture so that you can better understand code.

    10621_axis3dorient.png.zip

    Thank you very much

    C = thisComp.layer("C"); // Center Axis
    X = thisComp.layer("X");
    Y = thisComp.layer("Y");
    Z = thisComp.layer("Z");

    PC = C.toWorld(C.anchorPoint);
    PX = X.toWorld(X.anchorPoint);
    PY = Y.toWorld(Y.anchorPoint);
    PZ = Z.toWorld(Z.anchorPoint);

    deltaX = PC - PX;
    deltaY = PY - PC;
    deltaZ = PC - PZ;

    Xr = radiansToDegrees(Math.atan2(deltaX[0],deltaX[1]));
    Yr = radiansToDegrees(Math.atan2(deltaY[0],deltaY[1]));
    Zr = radiansToDegrees(Math.atan2(deltaZ[0],deltaZ[1]));

    [Xr,Yr,Zr];

    Ecko Locko replied 9 years, 7 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy