Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Positioning 2 cameras

  • Positioning 2 cameras

    Posted by Tim Andrews on December 16, 2009 at 7:41 pm

    I would be grateful for help with the maths. Although it may be simple, I have spent several hours in confusion. Thank you.

    I have an AE camera. It moves Postion and Rotation within the AE’s 3d space.I want to add a 2nd camera which remains a fixed distance away. The two cameras thus behave like the 2 eyes in our heads.
    I want an expression to set the position of this 2nd camera.

    Of course, I can already use:
    1) the xy and z Position of 1st camera Camera
    2) create some standard maths equations

    But. Despite much head scratching and using pencil and paper, I cannot work out the final equation. Or whether I am even doing it the best way. Thank you in advance.

    //(1)
    p0= thisComp.layer(“Camera 1”).transform.position[0];
    p1= thisComp.layer(“Camera 1”).transform.position[1];
    p2= thisComp.layer(“Camera 1”).transform.position[2];
    xr=thisComp.layer(“Camera 1”).transform.xRotation;
    yr=thisComp.layer(“Camera 1”).transform.yRotation;
    zr=thisComp.layer(“Camera 1”).transform.zRotation;

    //(2)
    mp=Math.PI/180;

    y1=100*Math.sin(xr * mp);
    z1=100*Math.cos(xr * mp);

    x1=100*Math.sin(yr * mp) ;
    z2=100*Math.cos(yr * mp) ;

    x2=100*Math.sin(zr * mp) ;
    y2=100*Math.cos(zr * mp) ;

    //(3)
    [p0+?,p1+?,p2+?]

    Tim Andrews replied 16 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    December 16, 2009 at 8:36 pm

    Why not just position your two cameras and make one the parent of the other?

    Dan

  • Tim Andrews

    December 17, 2009 at 4:39 pm

    I had started, using that way; but found that parenting one camera to another appeared to have unexpected results (the 2nd camera started pointing in the wrong directions). I put this down to my inexperience, and have made a note to re-examine it later).

    However. Fuelled by Mr Ebberts suggestion; I have created a 3d Null and made it the parent to both cameras. This appear to work much better(but I need my brain to stop spinning before checking everything).

    Thank you.

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