Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Projecting 3D to 2Dcomp

  • Projecting 3D to 2Dcomp

    Posted by Jan Sherlink on September 30, 2010 at 6:49 am

    I’ve got 2 circular elements ( A and B ) in 3D-space,
    the circles are moving and the camera is moving too.
    I want to connect the radius of the 2 circles with a “beam”,

    To place the start of the beam on circle A I use;

    p1=thisComp.layer(“A”).transform.position;
    p2=thisComp.layer(“B”).transform.position;
    delta = sub(p1, p2);
    angle=(Math.atan2(delta[1], delta[0]));
    radius=250;
    x=radius*(Math.cos(angle));y=radius*(Math.sin(angle));
    CO1=sub(p1,[x,y]);
    toComp(CO1)

    If i use this data on a 3D-layer it follows the radius correctly but,
    problem is that i can’t seem to project the coordinate to the screen
    to get the beam’s 2D coordinate.

    somebody has a clue ?
    thanks

    cya,

    Jan

    Jan Sherlink replied 15 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Chris Wright

    October 5, 2010 at 7:46 pm

    if you upload a scratch file, I’d be willing to help find the solution.

    https://technicolorsoftware.hostzi.com/

  • Jan Sherlink

    October 6, 2010 at 10:56 am

    thanks for the offer,
    but I’ve got it solved now.

    Mylenium pointed me to the “Lensflare” script on Dan Ebbert’s site
    (https://www.motionscript.com/masteri…lens-flare.html)
    seems like I was “looking” at my script the wrong way. A new view on it helped a lot.

    fixed it with this:

    L1=thisComp.layer("Bol1");L2=thisComp.layer("Bow1");
    p1=L1.transform.position; p2=L2.transform.position;
    delta = sub(p1, p2); ang=(Math.atan2(delta[1], delta[0]));
    radius=269;L1size=900/2;x=radius*(Math.cos(ang));y=radius*(Math.sin(ang) );
    L1.toComp([L1size-x,L1size-y,0])

    cya,

    Jan

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