-
Compensate for a parent’s orientation when using lookAt() function
Hello! Im using the lookAt() function to point Shape1 to Shape2. This works fine unless Shape1 is itself parented to another shape who’s orientation is anything but 0,0,0. Here’s the expression I’m currently using:
target = thisComp.layer("Star 2");
look=lookAt(thisLayer.toWorld(transform.anchorPoint), target.toWorld(target.anchorPoint));
[look[0],look[1]+180,look[2]]The 180° offset compensates for the default lookAt() result which always seems to offset the Y axis by 180°. I’ve tried every calculation I know of to compensate for the parent’s orientation but I believe the math is beyond me! Anyone able to solve this? Here’s a visual explanation of what I’m referring to:
And here’s a link to the file for testing
Thank you!