Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions calculate angle

  • Posted by Alex Harding on February 8, 2009 at 10:16 pm

    Hi,

    was wondering if there’s a way to calculate the angle of a 3d layer relative to the world / a camera.

    i want to mimic the effect from old sprite based pseudo 3d games like doom. i want to take, say, 8 photos of an object from 8 different angles, and make the layer switch to the correct image depending on the position of the camera.

    i was planning to use the auto orient feature so that the layer always faces the camera. however this doesn’t report any angle information that can be picked up by an expression, as far as i can see…

    any ideas?

    once i get the values of the angle, i was simply planning to have a precomp with 8 images on different frames and use time remapping to have the layer refference the correct image.

    help much appreciated!

    thanks,

    alex

    Dan Ebberts
    replied 17 years, 2 months ago
    2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    February 8, 2009 at 11:32 pm

    This should give you an angle you can do something with:

    C = thisComp.activeCamera;
    d = toWorld(anchorPoint) – C.toWorld([0,0,0]);
    angle = radiansToDegrees(Math.atan2(d[0],d[2]));

    Dan

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