Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions create a 3d plane from four 3d points (nulls)

  • create a 3d plane from four 3d points (nulls)

    Posted by Thor Sarup on September 1, 2011 at 1:56 pm

    i guess only three points are needed…
    nonetheless –
    can anybody provide me with the expression required to draw a 3d plane with it’s four (three) corners positioned in the nulls’ anchor point?

    I have exported some animated dummy object from 3ds max – and none of the free MAXscripts I have tried can export the rotation of an animated object properly. The positions are exported 100% accurate, so that’s why I came up with the idea of getting the rotation from the plane “created” by the four points.

    Bradon Webb replied 11 years, 1 month ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    September 1, 2011 at 2:57 pm

    I’m not sure what you mean by “draw a plane” (expressions can’t create anything), but if you had nulls representing three corners (lets say upper left, lower left and lower right), you could use an expression like this to derive the orientation for a 3D solid(I haven’t tested this, but it should be close):


    UL = thisComp.layer("UL").toWorld([0,0,0]);
    LL = thisComp.layer("LL").toWorld([0,0,0]);
    LR = thisComp.layer("LR").toWorld([0,0,0]);
    u = normalize(LR-LL);
    v = normalize(LL-UL);
    w = cross(u,v);
    sinb = clamp(w[0],-1,1);
    b = Math.asin(sinb);
    cosb = Math.cos(b);
    if (Math.abs(cosb) > .0005){
    c = -Math.atan2(v[0],u[0]);
    a = -Math.atan2(w[1],w[2]);
    }else{
    a = Math.atan2(u[1],v[1]);
    c = 0;
    }
    [radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)]

    Dan

  • Bradon Webb

    June 23, 2015 at 4:39 pm

    what about a script?

    something where you can select your 3 locator null layers, then run script and it will generate a new solid that is sized and rotated exactly to fit on those 3 points?

    seems possible. I have coded some stuff similar in 3D applications, but not familiar with AE scripting to know if something exists like this already.

    if not seems like it should.

  • Thor Sarup

    June 25, 2015 at 3:33 pm

    wow. 4 years later 🙂

    but I agree. Should be simple if you know the math. If there’s a javascript-ish version out there it should be fairly easy to convert it to ExtendScript.

  • Bradon Webb

    June 26, 2015 at 4:25 pm

    There is this:
    https://aescripts.com/connect-layers/

    which does a pretty good job, however I wish there was an option to create a solid layer with a mask rather than a shape layer.

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