Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions simulate 3d Yrotation on a 2d rectangle created with createPath

  • simulate 3d Yrotation on a 2d rectangle created with createPath

  • JuanLuis Vich

    December 20, 2022 at 4:26 am

    hello!

    This has probably been discussed before, but I have not been able to find the answer.

    Using createPath with this expression, I am following a 3d null called “3dNull”. Everything works great

    My question is, would it be possible to somehow modify it so that the rectangle created via createPath is always 90º relative to the Y axis of the null it follows? It would be like creating a plane perpendicular to the Y rotation plane of the null, but I don’t know if it is too tricky to work with the 4 vertices of the shape being purely 2d.

    Thank you very much in advance!

    L=thisComp.layer("3dNull")

    R=L.sourceRectAtTime(time,false);

    UL = fromCompToSurface(L.toComp([R.left,R.top]));

    UR = fromCompToSurface(L.toComp([R.left+R.width,R.top]));

    LR = fromCompToSurface(L.toComp([R.left+R.width,R.top+R.height]));

    LL = fromCompToSurface(L.toComp([R.left,R.top+R.height]));

    createPath(points = [[UR[0],UR[1]],[LR[0],LR[1]],[LL[0],LL[1]],[UL[0],UL[1]]]], inTangents = [[0,0],[0,0],[0,0],[0,0],[0,0]], outTangents = [[0,0],[0,0],[0,0],[0,0]],[0,0]], is_closed = true);

  • Dan Ebberts

    December 20, 2022 at 7:17 am

    I’m not 100% sure I understand what you’re asking for, but it might be something like this:

    L=thisComp.layer("3dNull");
    R=L.sourceRectAtTime(time,false);
    UL = fromCompToSurface(L.toComp([0,R.top,R.left]));
    UR = fromCompToSurface(L.toComp([0,R.top,R.left+R.width]));
    LR = fromCompToSurface(L.toComp([0,R.top+R.height,R.left+R.width]));
    LL = fromCompToSurface(L.toComp([0,R.top+R.height,R.left]));
    createPath([[UR[0],UR[1]],[LR[0],LR[1]],[LL[0],LL[1]],[UL[0],UL[1]]], [], [], true);
  • JuanLuis Vich

    December 20, 2022 at 9:40 am

    oh! that works!!
    thank you so much for the solution! i had started trying complicated matrix transformation options and had lost sight of the big picture!

Viewing 1 - 3 of 3 posts

Log in to reply.

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