
1. Re: Inverse Position Expression...still need some help please!!
Mylenium Mar 17, 2011 11:43 AM (in response to Matt Paintin)Sorry for not checking back, but the current forum problems make it difficult to post without being kicked out every 2 minutes.... What you want is very much in the project I was pointing you to  you need a relative offset along an imaginary view axis, so let's try this by commenting some updated code for the position of a secondary element a bit (parts you won't need not included):
cSource3D=thisComp.layer("Light"); //reference a 3D light as source
cSource2D=cSouce3D.toComp([0,0,0]); //convert to screen coordinates
cMiddleX=thisComp.width*0.5; //midpoint X
cMiddleY=this Comp.height*0.5; //midpoint Y
cDiffX=cSource[0]cMiddleX; //position difference X
cDiffY=cSource[1]cMiddleY; //position difference Y
cOffset=200; //distance from middle
X=cMiddleX+Math.sin(cAngle)*cOffset;
Y=cMiddleY+Math.cos(cAngle)*cOffset;
[X,Y]
Mylenium

2. Re: Inverse Position Expression...still need some help please!!
Matt Paintin Mar 17, 2011 11:59 AM (in response to Mylenium)Thanks Mylenium
I totally understand your problems replying....its not a problem....I know you are a busy guy! Im just grateful you have taken the time to help out!
Forgive my ignorance with the math on this subject
So if I am to understand it correctly to I just apply the complete revised expression to my secondary element?

3. Re: Inverse Position Expression...still need some help please!!
Mylenium Mar 17, 2011 1:16 PM (in response to Matt Paintin)cSource3D=thisComp.layer("Light"); //reference a 3D light as source
cSource2D=cSource3D.toComp([0,0,0]); //convert to screen coordinates
cMiddleX=thisComp.width*0.5; //midpoint X
cMiddleY=thisComp.height*0.5; //midpoint Y
cDiffX=cSource2D[0]cMiddleX; //position difference X
cDiffY=cSource2D[1]cMiddleY; //position difference Y
cAngle=Math.atan2(cDiffY,cDiffX); //find angle
cOffset=200; //distance from middle
X=cMiddleX+Math.sin(cAngle)*cOffset;
Y=cMiddleY+Math.cos(cAngle)*cOffset;
[X,Y]
Yes, simply copy&paste the above code ( I corrected the typos) to your secondary element and adjust the cOffset variable to suit (you could tie it to a slider, if needed; negative values move in opposite direction). Make sure to adjust the reference to the light in your comp (or your 3D Null). If you use an expression Point control or the Lensflare effect on a solid, you don't need the first line and the second line would then look something like that:
cSource2D=thisComp.layer("Lensflare").effect("Lens Flare")("Flare Center")
Mylenium

4. Re: Inverse Position Expression...still need some help please!!
Matt Paintin Mar 18, 2011 1:17 AM (in response to Mylenium)Thats great Mylenium
Again, thank you so much for taking the time to explain the details.