Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Magic Z-Rotation

  • Posted by Sebastian Martinez on August 15, 2008 at 11:05 am

    Hi everyone!
    I’m not a great scripter at all but this forum help me a lot to fix a lot of problems and broadened the possibilities in AE! So thank you Dan, Filip and all the others! I’ll keep on watching …

    There’s still a problem I have allready posted before, but couldn’t be answered for my own reasons.

    An auto-orient camera is flying around 360° in 3D space. How can I manipulate the Z-Rotaion of the camera that it stays straight with the “absolut” Z-vector of the space? Otherwise the the Z has to be adjusted brute force – tedious and stupid looking.

    So I tried it with this for the Z-Rotaion, a tweak of Dan Ebberts Expression to orient objects towards cameras. ‘Null 1‘s position is pickwipped to the camera’s viewpiont to get the “absolute” Z-vector for the camera. Didn’t work though:

    L = thisComp.layer(“Null 1”);
    s = L.scale/100;
    u = L.toWorldVec([s[0],0,0]);
    v = L.toWorldVec([0,s[1],0]);
    w = L.toWorldVec([0,0,s[2]]);
    sinb = clamp(w[0],-1,1);
    b = Math.asin(sinb/thisComp.pixelAspect);
    cosb = Math.cos(b);
    if (Math.abs(cosb) > .0005){
    c = -Math.atan2(v[0],u[0]);
    a = -Math.atan2(w[1],w[2]);
    }else{
    a = Math.atan2(u[1],v[1]);
    c = 0;
    }
    [radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)]

    Sebastian

    Sebastian Martinez

    Sebastian Martinez replied 17 years, 11 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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