ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Orientation in between two 3D-points

FAQ   •   VIEW ALL
 Orientation in between two 3D-points on May 29, 2017 at 5:45:29 pm

Hi folks,

I have three points, 'a', 'b' and 'c' in a 3D-room. On 'a' is a Null-Layer wich should orientate right in between towards 'b' and 'c'.

I do a bit scrigting but thats too tough for me...

thx
sebastian

 Re: Orientation in between two 3D-pointson May 29, 2017 at 6:31:08 pm

I have no idea if this is what you're after, but try this for Orientation:

b = thisComp.layer("b").position;
c = thisComp.layer("c").position;
lookAt(position,(b+c)/2)

Dan

 Re: Orientation in between two 3D-pointson May 30, 2017 at 10:46:46 am

Hi Dan,

Now the Null orientates towards half way between 'b' and 'c', wich is almost fine. In my case 'b' and 'c' have different distances from 'a'. The angle between 'a'-'b' and lookAt and 'a'-'c' and lookAt gets kind of unequal.

What I need is an orientation where these two angles remain equal no matter where in 3D space 'b' and 'c' float...

Hope this makes sense - I attached a scribble wich might help to explain. Image B is what I'm looking for.

(Background: 'b' is a lightsource and 'c' is a camera. The orientation of a Null on 'a' drives a little masked solid on a fixed distance. That one mimiks the light's reflection on a sphere)

Thanks a lot!
Sebastian

 Re: Orientation in between two 3D-pointson May 30, 2017 at 1:22:53 pm

Try this one:

b = thisComp.layer("b").position;
c = thisComp.layer("c").position;
a = position;
pb = a + normalize(b-a);
pc = a + normalize(c-a);
lookAt(position,(pb+pc)/2)

Fan