Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects orient a 3d layer between multiple 3d nulls

  • orient a 3d layer between multiple 3d nulls

    Posted by Jason Mckee on July 23, 2014 at 3:44 am

    is it possible to orient a 3d layer between multiple 3d nulls. it seems like there should be a way to orient a 3D layer between 3 nulls.

    Walter Soyka replied 11 years, 10 months ago 2 Members · 1 Reply
  • 1 Reply
  • Walter Soyka

    July 23, 2014 at 2:29 pm

    [Jason McKee] “is it possible to orient a 3d layer between multiple 3d nulls. it seems like there should be a way to orient a 3D layer between 3 nulls.”

    Looks like a good feature request for keen_3dLayerTools [link] [link]!

    In the meantime, try these expressions.

    Position:
    // applied to the position parameter, this expression computes the triangular centroid of a plane defined by three points
    p1 = thisComp.layer("Null 1").transform.position;
    p2 = thisComp.layer("Null 2").transform.position;
    p3 = thisComp.layer("Null 3").transform.position;

    // the centroid is the average of these points
    centroid = div(p1+p2+p3,3);

    Orientation:
    // applied to the orientation parameter, this expression looks down the normal of the a plane defined by three points from its centroid
    p1 = thisComp.layer("Null 1").transform.position;
    p2 = thisComp.layer("Null 2").transform.position;
    p3 = thisComp.layer("Null 3").transform.position;

    // the centroid is the average of these points
    centroid = div(p1+p2+p3,3);

    // the normal vector of a plane is (p2-p1) x (p3-p1)
    n = normalize(cross(p2-p1,p3-p1));

    // use lookAt to get the orientation necessary to look along the normal vector from the centroid
    lookAt(centroid,centroid+n)

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

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