Copy link to clipboard
Copied
Hello,
I use the lookAt function to orient a text layer to a NULL layer position but I want to be able to rotate the text layer on the X axis too.
To look at the NULL layer correctly, I need to set the Y rotation to 270°
I think the problem is here, if I want to rotate on the X axis correctly, the Y rotation must be 0 or 180/-180.
I think that I need an expression to recalculate the Y and Z orientation with the X orientation set to 0.
And maybe an expression to set Y rotation value too.
Thanks in advance for any help!
1 Correct answer
Would it help to put the lookAt() expression on a 3D null and parent the text layer to that, so you could adjust the text layer's rotation independently?
Copy link to clipboard
Copied
Would it help to put the lookAt() expression on a 3D null and parent the text layer to that, so you could adjust the text layer's rotation independently?
Copy link to clipboard
Copied
Yes Dan, thank you it's exactly what I want to do.
But is there a way to calculate the orientation?
Copy link to clipboard
Copied
Probably, but unless it's trivial (which this may be, I don't know) things can get out of hand pretty quickly when you have to do 3D rotation matrix math...
Copy link to clipboard
Copied
http://www.motionscript.com/design-guide/auto-orient-y-only.html
Can easily be modified to work for a different axis. That and of course there's a ton of other "targeting" expressions out there that could be used as well.
Mylenium
Copy link to clipboard
Copied
Thanks Mylenium,
The expression returns an angle
delta = toWorld(anchorPoint) - thisComp.activeCamera.toWorld([0,0,0]);
radiansToDegrees(Math.atan2(delta[0],delta[2]))
but I need to convert the original orientation from [X, Y, Z] to [0, Y, Z]
I tried to add or substract the angle but it doesn't work.
Copy link to clipboard
Copied
Finaly, don't need to calculate the new orientation using Dan's trick, then
just need to unparent or delete the new NULL layer to get the correct orientation.

