Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression linked angles?

  • Expression linked angles?

    Posted by Spritelyjim on August 1, 2007 at 5:09 am

    I have an AE project that requires an expression using math I don’t know. I’ll simplify the situation for explanation: I have an object (say a small solid) that I want to place on the imaginary line between a 3D camera’s position and it’s point of interest. While the camera changes its angle and distance to the anchor point, I want the object to match the change in angle (ie stay on that imaginary line), while remaining a fixed distance from the anchor point. Can anyone help me set up an expression to do this? I would really appreciate it.

    (In theory, I could link both the camera and the object to a null and rotate the null while animating the camera’s z distance, thereby maintaining the objects distance while animating the camera, however that makes it very difficult to put the camera where I want it. I really need this to be driven by an expression.)

    Spritelyjim replied 18 years, 9 months ago 3 Members · 5 Replies
  • 5 Replies
  • Colin Braley

    August 1, 2007 at 5:27 am

    Try this:

    cameraPoi = thisComp.layer(“Main Cam”).transform.pointOfInterest;
    cameraPos = thisComp.layer(“Main Cam”).transform.position;
    dist = 100;//distance from point of interest
    //–
    vec = normalize( cameraPos – cameraPoi );
    vec * dist + cameraPoi

    just pick whip cameraPoi to the camera’s point of interest, and cameraPos to the camera’s position. Change distance to change the layer’s distance away from the point of interest.

    ~Colin

    http://www.colinbraley.com

  • Spritelyjim

    August 1, 2007 at 7:01 am

    I’ll try it. Thanks!

  • Darby Edelen

    August 1, 2007 at 3:13 pm

    [spritelyjim] “I want the object to match the change in angle (ie stay on that imaginary line), while remaining a fixed distance from the anchor point.”

    By anchor point are you referring to the camera’s point of interest or its location?

    It sounds like parenting the layer to the camera should solve your problem.

    Darby Edelen
    DVD Menu Artist
    Left Coast Digital
    Aptos, CA

  • Spritelyjim

    August 1, 2007 at 4:20 pm

    Sorry, I use anchor point as shorthand for point-of-interest, and I try to consciously change that in posts. Both are revealed with the shortcut ‘a’ so that’s probably why I associate the two.

    As for parenting, it wouldn’t work, because I’m trying to maintain a fixed distance from the point-of-interest, not the camera.

  • Spritelyjim

    August 1, 2007 at 5:25 pm

    This worked perfectly. Thanks!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy