Page 1 of 1

layer orientation without "lookat"

Posted: August 8th, 2008, 12:55 am
by Maxime
Hi,

I have 3 layers A, B, C inside my comp.
In a 3D space, B is positioned between A and C using this basic stuff:
B.position = (A.position+C.position)*.5
Now I would like B to orient towards those layers just like using Lookat(,), but whitout using Lookat(,).
This, because later on, I want B's orientation to depend partly on other variables.

I am a beginner at trigo and Javascript and I get really strange results from my use of Dan Ebbert's stuffs about trigo and inversed kinematics.

Can anyone help ?

Maxime

Re: layer orientation without "lookat"

Posted: August 8th, 2008, 8:36 am
by kobyg
You could always add to the lookAt another angle to change the orientation as you desire such as:

lookAt(A.position,C.position) + [ANGx,ANGy,ANGz]

Where ANGx, ANGy, ANGz are the angles you want to rotate the layer in x,y,z axes respectively, in addition to the exact orientation the lookAt gave you.

I don't know how you want to change the orientation later, but you could use a Slider Control with keyframes to add different values at different times, and this way you could orient the B layer towards A&C at the begining and then change the oreintation as you want using the keyframes at the slider.

(If you need to change all 3 angles (ANGx, ANGy, ANGz), you will need to use 3 Sliders, or use a 3D array expression)

I hope this helped.