ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Orientation in between two 3D-points

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sebastian Martinez
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


Return to posts index

Dan Ebberts
Re: Orientation in between two 3D-points
on 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



Return to posts index

Sebastian Martinez
Re: Orientation in between two 3D-points
on May 30, 2017 at 10:46:46 am

Hi Dan,
thank you very much for your quick reply! It almost works!

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



Return to posts index


Dan Ebberts
Re: Orientation in between two 3D-points
on 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



Return to posts index

Sebastian Martinez
Re: Orientation in between two 3D-points
on May 30, 2017 at 2:21:32 pm

Mr Ebberts, this is exactly what I was looking for. Magic - you are a master!

Respects
Sebastian


Return to posts index

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