ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

orient a 3d layer between multiple 3d nulls

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jason McKeeorient a 3d layer between multiple 3d nulls
by on Jul 23, 2014 at 3:44:37 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.


Return to posts index

Walter SoykaRe: orient a 3d layer between multiple 3d nulls
by on Jul 23, 2014 at 2:29:26 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 [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]