Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Nulls, animating POI and cameras…

  • Nulls, animating POI and cameras…

    Posted by Paul Maguire on May 16, 2008 at 11:05 am

    Hi again.

    I find it really tricky to get my feeble brain around this.

    I have a camera parented to a Null. The camera is set -500 in the z (this null is used to easily animate and control the camera). The null is set at [0,0,0], and rotates around another 3D layer also set at [0,0,0], so we ‘fly around’ the object. Fine. Problem occurs when I try to animate the camera’s POI to another object. I want to look at something else as we fly around – in fact I want to be able to animate the camera’s POI as the camera flys around.

    Simply setting the camera’s POI with an expression like:

    thisComp.layer(“POInull”).position;

    …fails – and I know it’s to do with Layer Space transforms (because camera is child of Null), so I try this is in the POI expression box for the camera:

    toWorld(thisComp.layer(“POInull”).anchorPoint);

    …and this fails too.

    I just want to attach the camera’s POI to a Null, but also have the camera be a child of another Null. I’m sorry for being so lame but it’s just doing my head in. Any help most welcome. Also – any good pointers to info on this type of thing? I wish I was more confident about layer space transforms in AE expressions – always seems to come up in the studio.

    Thanks.

    Regards, Paul.

    Michael Powers replied 10 years, 12 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    May 16, 2008 at 1:27 pm

    Try this:

    L = thisComp.layer(“POInull”);
    parent.fromWorld(L.toWorld(L.anchorPoint))

    Dan

  • Paul Maguire

    May 16, 2008 at 2:49 pm

    It works perfectly. Thanks Dan.

    So to understand this so I idon’t keep having to come back to you on almost the same question…

    L = thisComp.layer(“POI”);

    (L is a local reference to layer “POI”)

    parent.fromWorld(L.toWorld(L.anchorPoint))

    So, I simply don’t understand this, even with the manuals here!
    L.toWorld(L.anchorPoint)
    this takes the anchor point of the POI layer and returns a 3D coordinate of it’s absolute position in space – but the anchorPoint doesn’t ever change: always [0,0,0] ??? I don’t even get why it’s L.toWorld(L.anchorpoint) – why not simply toWorld(L.anchorPoint)???

    I’m looking at the rest of the line – sigh – I think I’ll stop. Sorry. I’m frustrated. I need to understand how this works. Is it possible for you to quickly break this second line into pseudocode? I need a revelatory moment. If not, no worries – I’ve got to get to the bottom of it.

    Regards, Paul.

  • Dan Ebberts

    May 16, 2008 at 3:25 pm

    L.toWorld(L.anchorPoint) is only necessary if your POI layer has a parent. If it doesn’t, you could just use L.position to get the world position of the layer.

    In any case you use L.toWorld() instead of just toWorld() because you want to translate from the POI layer’s layer space. If you use toWorld() without specifying the layer, the expression will assume that you want to translate the POI layer’s anchor point from the camera’s layer space, which doesn’t make any sense.

    When a layer becomes the child of another layer, it assumes the parent’s layer space. So in this case, once we get the POI layer’s positon into world space, we need to traslate it from world space to the camera’s parent’s layer space.

    Hope that helps. 😉

    Dan

  • Michael Powers

    May 21, 2015 at 7:24 pm

    Thnx Dan. Space Transforms in AfterFX are possibly the most poorly named and confusing functions in history of coding. I would rather slerp a quaternion in maxscript.

    Michael Powers
    Creative Director / Animation
    Cramer
    http://www.cramer.com
    https://vimeo.com/mpowers

    3DBOXX W8920Processor 32.0 GB RAM
    Dual Xeon CPU E5-2670 0 @ 2.60GHz, 2601 Mhz, 8 Core(s), 16 Logical Processor(s)
    Windows 7 Professional – 6.1.7601 Service Pack 1 Build 7601
    NVIDIA GTX TITAN Black RAM 6.0 GB Driver Version 344.48

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