Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions control 3D position to cam

  • control 3D position to cam

    Posted by Patrick Blot on September 17, 2024 at 5:15 am

    Hello, I’m trying to create an expression so that a 3d layer moving in z always stays within the camera’s visible cone.

    If I only move it in Z according to its starting position, it will disappear, but in this case I’d like it to always be visible, so I’d like to calculate the x and y positions so that it remains visible in the camera’s cone.

    I hope this makes sense, otherwise I’ll draw a picture.

    thanks

    Patrick Blot replied 3 weeks, 5 days ago 2 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    September 17, 2024 at 5:24 am

    It’s a little ambiguous, so a picture would help.

  • Patrick Blot

    September 17, 2024 at 8:39 am

    yes I suspected, here is an image

    Basically, the photo that zooms in on the camera must be close to the 960×540 axis of the camera, which is in the center.

    to calculate a displacement in x and y

  • Dan Ebberts

    September 17, 2024 at 1:36 pm

    Are you animating the photos by moving them on their z axis?

  • Dan Ebberts

    September 17, 2024 at 2:40 pm

    If that’s the situation, layer moving on z, camera not moving, a position expression like this might work:

    p0 = valueAtTime(0);
    d = length(value,p0);
    v = normalize(thisComp.layer("Camera 1").position - p0);
    p0 + v*d
  • Patrick Blot

    September 17, 2024 at 4:55 pm

    yes, I only animate the Z of the photos, but I have more than 200 photos, which is why I’m looking to automate the moving process.

    in x position, the point must be close to the axis which is at 960

    for example, if my layer is positioned at 662 pixels, it needs to get closer to the 960 value to remain on the camera axis

    similarly, if y is at 842, it needs to approach the 540 value

    the first image is with only the z and the 2nd is with x and y corrected by hand

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