Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Controlling 1 layers position by another layers rotation

  • Controlling 1 layers position by another layers rotation

    Posted by Gallion311 on September 3, 2007 at 3:58 am

    Whats up guys, trying to see if it’s possible to link a layers position, by another layers rotation.

    So a camera rotates 75 degrees, and an image layer moves that approriate distance, but in position as apposed to rotation.

    Hopefully I described it well enough, I;m trying to do some matchmoving, but the exported file creates a 3D camera, not an X and Y position like the AE tracker.

    Thanks!
    ryan

    Gallion311 replied 19 years ago 2 Members · 2 Replies
  • 2 Replies
  • Kevin Camp

    September 4, 2007 at 2:49 pm

    you can use a the linear() function to try and interpret rotation as position. something like this as the position expression would move a layer as a the 3d ‘rotation layer’ turns on the x and y axis:

    x = linear(thisComp.layer(“rotating layer”).transform.yRotation, -45, 45, 0, 720);
    y = linear(thisComp.layer(“rotating layer”).transform.xRotation, -45, 45, 480, 0);
    [x, y]

    it takes the rotation values between 90 degrees (-45 – 45 = 90) and plots that value over a 0-720 px (the comp width) horizontally and 480-0 px vertically… you would like to know the camera’s viewing angle so you could use that to define the rotation — in my expression i arbitrarilly used 90, but if your veiwing anlg was 60, the values might be -30, 30.

    using this will most likely require some trial and error to get values that will seem natural.

    do you think you’d be better off using the 3d camera data on a 3d camera and position your layers in 3d space? you should get more realistic movement in you scene.

    Kevin Camp
    Designer – KCPQ, KMYQ & KRCW

  • Gallion311

    September 4, 2007 at 7:46 pm

    do you think you’d be better off using the 3d camera data on a 3d camera and position your layers in 3d space? you should get more realistic movement in you scene.

    Yeah, that was my first notion as well, but I’ve never been a fan of After Effects’ 3d stuff and I ran into a problem. I was compositing in a flat image as a matte painting background (some stormy clouds, a castle on a hill) but when the camera rotated (panned) in 3d, the flat background was heavily skewed due to the perspective offset. So it was evident that it was just a flat plane in 3d space. My other solution would be to create a makeshift cylinder, composed of 4 different flat planes…but I figured there may be a more optimal solution using a script to turn the 3d rotation into 2D movement.

    As it turns out I did some more Googling, and there’s a set of scripts called MoCon for AE that help when importing/exporting cameras to and from AE.

    http://www.3dmation.com

    One of those scripts was called 3D to 2D which does excatly what I needed.

    I’ll still play around with your script though becuase I always prefer having some understanding of what I’m doing rather that just clicking a button.

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